![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
kotlin
原总破局
刻意训练,积极反馈。
展开
-
lambda表达式
参考慕课网Kotlin入门与进阶Lambda表达式1、函数 fun sum(arg1:Int, arg2:Int)=arg1 + arg2转化成lambda表达式val sum= {arg1:Int, arg2:Int->arg1 + arg2}arg1:Int arg2:Int 参数->分隔符arg1+arg2运算体分隔符不一定需要val printHel...原创 2019-07-19 11:30:20 · 153 阅读 · 0 评论 -
kotlin的区间
区间闭区间val range:IntRange = 0..60 //[0,60]开区间val rangeExclusive:IntRange = 0 until 60//[0, 60)public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRa...原创 2019-07-19 14:31:40 · 334 阅读 · 0 评论 -
kotlin数组
数组 Arrayvar intArray:IntArray = intArrayOf(1,2,10,25,30)var charArray:CharArray = charArrayOf('a','b','c','d')var stringArray:Array<String> = arrayOf("I", "am", "Forest")使用intArray.size 数组长...原创 2019-07-19 14:53:41 · 258 阅读 · 0 评论 -
Kotlin 运算符重载 中缀表达式
基本运算符运算符本质上就是一个函数class Complex(val real:Double, var imaginary:Double){ operator fun plus(other:Complex):Complex{ return Complex(real + other.real, imaginary + other.imaginary) } ...原创 2019-07-19 15:25:19 · 195 阅读 · 0 评论