android-studiokotlinscratch-file

Kotlin Scratch File Android Studio readline()


Can I use readline() in a Scratch File of Android Studio? Where to enter input?


Solution

  • I'm showing an example of how to do it on Intellij IDEA, however the steps would remain the same for Android Studio too, as it's built on Intellij itself.

    You can run the scratch file by right clicking on the scratch file editor and selecting Run 'scratch.kts' (would show the name of the current scratch file).

    enter image description here

    That would run the scratch file and show on the console in the Run tab below, where you can enter the input for readline().

    enter image description here