To test Kotlin Code snippets you can also use Android Studio Scratch File.
Code that is to be executed needs to be written outside and Function.
Code is written on the left side and output is displayed on the right side.
Start Android Studio
File
New
Scratch File
Kotlin
Code
//===========================================================================================================
// CLASS: Person
//===========================================================================================================
class Person {
fun sayHello() { println("Hello") }
}
//===========================================================================================================
// FUNCTION: main
//===========================================================================================================
fun main() {
var john = Person()
john.sayHello()
}
Output
Hello
Android Studio Scratch File