以前のリビジョンの文書です
fun main(){ println("hello world") } ↓ hello world
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val but = findViewById(R.id.button) as Button but.setOnClickListener { Toast.makeText(this, "テストメッセージです", Toast.LENGTH_SHORT).show() } } }
fun maxOf(a: Int, b: Int): Int { if (a > b) { return a } else { return b } }
↓同じ
fun main() { println("max of 0 and 42 is ${maxOf(0, 42)}") }