Android 入门
kotlin入门(研究一下官方文档)
创建项目
Intellij IDEAnew ->project选择Interllij的system,选择add sample code,开始就生成一个hello word的程序
1 | fun main() |
fun用来创建一个函数,经典的main()函数为程序的开始地方,这创建函数
read-only variables(常量)用val
Mutable variables用var
string templates(字符串模板)->在字符串中invert(嵌入值)用sign $,而模板中对一段代码求值还是用$ + curly braces{}
1 | fun main() |
basic types
很关键,根据数据类型可知道其含有那些functions与properties(属性)
| category(类型) | basic types | Example code |
|---|---|---|
| Intergers(整数) | Byte,short,Int,Long | val amount: Long = 250_0000_000 |
| Unsigned Intergers | UBYte,Ushort | |
基础语法
包声明
1 | package com.runob |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 wuye的博客!
