1.函数
![](https://img.haomeiwen.com/i6163725/12a455444c650f1d.png)
Screen Shot 2020-04-16 at 1.04.34 AM.png
1>函数体可以房子等号后面;函数可以直接赋给一个变量时 函数名不用写。
![](https://img.haomeiwen.com/i6163725/ec4ff5146cfc31a1.png)
Screen Shot 2020-04-16 at 1.02.20 AM.png
2.Lambda表达式 就是匿名函数
![](https://img.haomeiwen.com/i6163725/82b1287e2f123eb7.png)
Screen Shot 2020-04-16 at 1.25.25 AM.png
用法:函数的最后一个参数如果是lambda表达式,则可以把lambda表达式移到()后面,然后如果()里面什么都没有,那么我就可以把()删掉。
![](https://img.haomeiwen.com/i6163725/68c4ee05a780cc66.png)
Screen Shot 2020-04-16 at 1.21.27 AM.png
![](https://img.haomeiwen.com/i6163725/8ccce1140886844e.png)
Screen Shot 2020-04-16 at 1.27.03 AM.png
![](https://img.haomeiwen.com/i6163725/afe0ac0087b9ac88.png)
Screen Shot 2020-04-16 at 1.27.27 AM.png
![](https://img.haomeiwen.com/i6163725/54079ffb9a973bdc.png)
Screen Shot 2020-04-16 at 1.31.20 AM.png
3.类的成员
1>.kotlin中模式实现了get set,也可以通过下面的方式来进行重写
![](https://img.haomeiwen.com/i6163725/d337ee1d00edcd48.png)
Screen Shot 2020-04-16 at 12.15.09 PM.png
2>.延迟加载,使用了lateinit之后,在使用之前一定要初始化 不然就crash;
![](https://img.haomeiwen.com/i6163725/2f96bc2e91359353.png)
Screen Shot 2020-04-16 at 12.20.49 PM.png
4.if和when
![](https://img.haomeiwen.com/i6163725/b7753e2c4e90e5c5.png)
Screen Shot 2020-04-16 at 12.51.22 PM.png
![](https://img.haomeiwen.com/i6163725/a95112294d5a22f4.png)
Screen Shot 2020-04-16 at 12.51.10 PM.png
5.循环
![](https://img.haomeiwen.com/i6163725/a7f868cfc5f96c4c.png)
Screen Shot 2020-04-16 at 12.53.41 PM.png