forked from uestc/Notes
1
0
Fork 0
Notes/Android开发笔记/Kotlin基本语法笔记.md

27 lines
325 B
Markdown
Raw Normal View History

2024-10-17 15:36:48 +08:00
```kotlin
Unit : 相当于JAVA的void
```
kotlin中when的用法
```kotlin
fun foo(value: Int): String {
return when (value) {
0 -> {
"Zero"
}
1 -> {
"One"
}
2 -> {
"Two"
}
else -> {
"Other"
}
}
}
```