差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| android:kotlin [2019/03/19 22:45] – [Kotlin(コトリン)] ともやん | android:kotlin [2019/05/18 02:23] (現在) – 外部編集 非ログインユーザー | ||
|---|---|---|---|
| 行 24: | 行 24: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ==== Simplest version ==== | ||
| + | <code kotlin> | ||
| + | package hello | ||
| + | |||
| + | fun main() { | ||
| + | println(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== An Object-oriented Hello ==== | ||
| + | <code kotlin> | ||
| + | class Greeter(val name: String) { | ||
| + | fun greet() { | ||
| + | println(" | ||
| + | } | ||
| + | } | ||
| + | |||
| + | fun main(args: Array< | ||
| + | Greeter(args[0]).greet() | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Coroutines ==== | ||
| + | <code kotlin> | ||
| + | suspend fun main() = coroutineScope { | ||
| + | for(i in 0 until 10) { | ||
| + | launch { | ||
| + | delay(1000L - i * 10) | ||
| + | print(" | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||