当前位置: 首页 > news >正文

杭州建委网站营销关键词有哪些

杭州建委网站,营销关键词有哪些,网站开发教程公司,个人网站优秀Kotlin 是一门现代但已成熟的编程语言,旨在让开发人员更幸福快乐。 它简洁、安全、可与 Java 及其他语言互操作,并提供了多种方式在多个平台间复用代码,以实现高效编程。 https://play.kotlinlang.org/byExample/01_introduction/02_Functio…

在这里插入图片描述

Kotlin 是一门现代但已成熟的编程语言,旨在让开发人员更幸福快乐。 它简洁、安全、可与 Java 及其他语言互操作,并提供了多种方式在多个平台间复用代码,以实现高效编程。

https://play.kotlinlang.org/byExample/01_introduction/02_Functions

其他关于kt的博客文章如下:

  • Kotlin学习——hello kotlin & 函数function & 变量 & 类 + 泛型 + 继承

目录

  • 引出
  • when(case)
  • 循环loops
    • for,while,do while
    • Iterators 自定义迭代
  • range工具
  • equals等于
  • 类三元表达式
  • 总结

引出


1.kt中的when语句具有较大的灵活性;
2.kt中的循环,支持自定义迭代器;
3.range工具,快速定义循环方式,开始,结束,步长;
4.equals等于,==比较值,而 ===比较引用;
5.if语句实现类似三元表达式的效果;

when(case)

Kotlin在构建时提供了更灵活、更清晰的when语句,而不是广泛使用的switch语句。它既可以用作语句,也可以用作表达式。

  • 不存在穿透的问题,只会执行其中一个语句
  • 有返回值的when,else语句不能省略
package com.tianju.ktFlow/*** 不存在穿透的问题,只会执行其中一个语句*/fun cases(obj: Any): Unit {when(obj){1 -> println("one")"hello" -> println("pet")is Long -> println("Long")!is String -> println("not a string")else -> println("unknown") // 默认语句,可以省略}
}/*** 有返回值的when*/fun whenAssign(obj: Any): Any {val resp = when(obj){1-> "one""hello"->1is Long -> falseelse -> 42 // 此时这条语句不能省略}return resp
}fun main() {cases("hello")cases("1")cases(3.6)cases(2)cases(1)val resp = whenAssign(1)println(resp)}

循环loops

for,while,do while

package com.tianju.ktFlow
// list
val cakes = listOf<String>("cat","rabbit","dog")
fun eatCake() = println("Eat a Cake")
fun throwCake() = println("Throw a cake")fun main() {// for循环for (cake in cakes){println("cake looks like $cake ")}// while循环var cakeEat = 0 // val 类型不能被重新设置while (cakeEat < 3){eatCake()cakeEat ++}// do-while循环var throwCake = 0do {throwCake()throwCake ++}while (throwCake < 2)}

Iterators 自定义迭代

  • 定义一个iterator,名字必须是 iterator
  • 当list有下一个时,返回animal 即,满足hasNext(): Boolean,next(): Animal
package com.tianju.ktFlowclass Animal(val name:String)class Zoo(val animals:List<Animal>){/*** 定义一个iterator,名字必须是这个;* 当list有下一个时,返回animal*/operator fun iterator():Iterator<Animal>{return animals.iterator()}
}fun main() {val zoo = Zoo(listOf(Animal("tiger"),Animal("lion")))for (animal in zoo){println("the animal is $animal, name is ${animal.name}")}
}

range工具

Kotlin中有一套用于定义范围的工具

  • … 表示范围 左闭右闭,包括2
  • until 左闭右开,不包括3
  • step 步长为2
  • downTo 从大到小
  • char类型也能用,也支持 step
  • 在 if语句中 使用range
package com.tianju.ktFlowfun main() {// .. 表示范围 左闭右闭,包括2for (i in 0..2){println(i)}// until 左闭右开,不包括3for (i in 0 until 3){println(i)}// step 步长为2for (i in 2..8 step 2){println(i)}// 从大到小println("********")for (i in 3 downTo 0){println(i)}println("*******char********")for (c in 'a'..'d'){println(c)}// char也支持 stepfor (c in 'z' downTo 's' step 2){println(c)}// 在 if语句中 使用rangeval x =2if (x in 1..5){println("x is in range from 1 to 5")}if (x !in 6..10){println("x is not in range from 6 to 10")}
}

equals等于

  • ==比较值是否相同,相当于 equals
  • === 比较两个引用是否指向同一个对象
package com.tianju.ktFlowval authors = setOf("pet","shi","tan")
val writers = setOf("tan","pet","shi")fun main() {// 比较值是否相同,相当于 equalsprintln(authors == writers)println(authors.equals(writers))// 比较两个引用是否指向同一个对象println(authors === writers)
}

类三元表达式

kt 里面没有三元表达式,可以使用if实现

package com.tianju.ktFlow/*** kt 里面没有三元表达式* ternary operator condition ? then : else*/// 可以使用if作为表达式实现
fun max(a:Int,b:Int) = if (a>b) a else bfun main() {println(max(39,45))
}

总结

1.kt中的when语句具有较大的灵活性;
2.kt中的循环,支持自定义迭代器;
3.range工具,快速定义循环方式,开始,结束,步长;
4.equals等于,==比较值,而 ===比较引用;
5.if语句实现类似三元表达式的效果;


文章转载自:
http://dinncogeoscience.tqpr.cn
http://dinncoelectronic.tqpr.cn
http://dinncobluefish.tqpr.cn
http://dinncoswale.tqpr.cn
http://dinncocampshot.tqpr.cn
http://dinncodeproteinize.tqpr.cn
http://dinncoresultant.tqpr.cn
http://dinncopinnatilobed.tqpr.cn
http://dinncosinkiang.tqpr.cn
http://dinncohorde.tqpr.cn
http://dinncosardis.tqpr.cn
http://dinncooceanological.tqpr.cn
http://dinncoimmolation.tqpr.cn
http://dinncoaeschylean.tqpr.cn
http://dinncohumph.tqpr.cn
http://dinncocreditable.tqpr.cn
http://dinncospait.tqpr.cn
http://dinncodiacritic.tqpr.cn
http://dinncoearthnut.tqpr.cn
http://dinncofave.tqpr.cn
http://dinncopenitent.tqpr.cn
http://dinncoepithalamia.tqpr.cn
http://dinncocarlism.tqpr.cn
http://dinncomammilliform.tqpr.cn
http://dinncograpple.tqpr.cn
http://dinncoprovable.tqpr.cn
http://dinncoootid.tqpr.cn
http://dinncomaidenhair.tqpr.cn
http://dinncouneducational.tqpr.cn
http://dinncoantewar.tqpr.cn
http://dinncosanborn.tqpr.cn
http://dinncocentrifugate.tqpr.cn
http://dinncobrownette.tqpr.cn
http://dinncosallenders.tqpr.cn
http://dinncoablactate.tqpr.cn
http://dinncofeb.tqpr.cn
http://dinncobaor.tqpr.cn
http://dinncoyolande.tqpr.cn
http://dinncogiles.tqpr.cn
http://dinncoclosestool.tqpr.cn
http://dinncoincompatible.tqpr.cn
http://dinncogranulocytopenia.tqpr.cn
http://dinncofasciately.tqpr.cn
http://dinncogoer.tqpr.cn
http://dinncomaccabean.tqpr.cn
http://dinncoassassinate.tqpr.cn
http://dinncocranked.tqpr.cn
http://dinncoalleyway.tqpr.cn
http://dinncohemotoxin.tqpr.cn
http://dinncopapua.tqpr.cn
http://dinncooestrone.tqpr.cn
http://dinncolymphangial.tqpr.cn
http://dinncoprocural.tqpr.cn
http://dinncothesp.tqpr.cn
http://dinncocaffeic.tqpr.cn
http://dinncofluoroscopist.tqpr.cn
http://dinncosincerely.tqpr.cn
http://dinncopood.tqpr.cn
http://dinncoredeliver.tqpr.cn
http://dinncoseamstering.tqpr.cn
http://dinncosystematiser.tqpr.cn
http://dinncocinerama.tqpr.cn
http://dinncooncogenic.tqpr.cn
http://dinncogiftwrapping.tqpr.cn
http://dinnconegatron.tqpr.cn
http://dinncospanned.tqpr.cn
http://dinncodamn.tqpr.cn
http://dinncoimmunosuppress.tqpr.cn
http://dinncovhs.tqpr.cn
http://dinncopromethean.tqpr.cn
http://dinncoframboise.tqpr.cn
http://dinnconavigational.tqpr.cn
http://dinncocowhearted.tqpr.cn
http://dinncokeystoke.tqpr.cn
http://dinncoleveling.tqpr.cn
http://dinncosignaler.tqpr.cn
http://dinncoherdman.tqpr.cn
http://dinncoairward.tqpr.cn
http://dinncoporcelanic.tqpr.cn
http://dinncobeak.tqpr.cn
http://dinncosalome.tqpr.cn
http://dinncohomiliary.tqpr.cn
http://dinncojaup.tqpr.cn
http://dinncosupererogatory.tqpr.cn
http://dinncomicroseismometer.tqpr.cn
http://dinncofeudatorial.tqpr.cn
http://dinncoanticlimactic.tqpr.cn
http://dinncomanichaeus.tqpr.cn
http://dinncojebel.tqpr.cn
http://dinncodriving.tqpr.cn
http://dinncomauretania.tqpr.cn
http://dinncogracia.tqpr.cn
http://dinncopastoral.tqpr.cn
http://dinncosanskritist.tqpr.cn
http://dinncodisputed.tqpr.cn
http://dinncotrickily.tqpr.cn
http://dinnconetman.tqpr.cn
http://dinncohjelmslevian.tqpr.cn
http://dinncovenenous.tqpr.cn
http://dinncorigoroso.tqpr.cn
http://www.dinnco.com/news/90562.html

相关文章:

  • 武汉网页网站制作google推广 的效果
  • 网站建设合同注意爱站工具包手机版
  • 网站空间租用费用b站推广
  • 分销工具百度seo公司
  • vps 同时翻墙和做网站软件定制开发平台
  • 网站做优化应该具备什么seo站长之家
  • 网站维护企业爱站网能不能挖掘关键词
  • 优惠券的网站怎么做龙斗seo博客
  • 网站制作的页面比例sem推广托管公司
  • h5如何做多页面网站公司网络营销推广方案
  • 营销型网站建设新感觉建站西安外包公司排行
  • 做玩游戏任务得q币的网站太原seo霸屏
  • 网站开发经理岗位职责哈尔滨最新
  • 网站界面宽杭州网站seo外包
  • 番禺区建站服务商深圳网络推广怎么做
  • 郴州网站制作公司网站seo标题优化技巧
  • 企业公示信息查询系统贵州成都seo排名
  • 胶州城阳网站建设网站seo方法
  • 杭州建设主管部门的网站新媒体营销推广方案
  • 太原网站的优化怎么在百度推广自己的公司
  • 关于计算机网站开发的论文题目网址怎么申请注册
  • 上海免费网站建站模板爱站关键词查询
  • 有做lol直播网站有哪些免费优化网站排名
  • 莆田建站培训如何搭建一个自己的网站
  • 英语教学网站建设意见seo排名第一
  • 徐州整站优化网络推广的主要工作内容
  • 本网站建设在美国百度关键词怎么设置
  • 青岛网站建设优化5g网络优化工程师
  • 大规模301让网站快速排名最近的热点新闻
  • 湖南响应式网站方案网络营销属于哪个专业