Using Android Studio for experimenting with Kotlin features

I’m using Android Studio for developing Android apps using Kotlin. (At this point I’m still learning.)

Is there a simple way to try out Kotlin features in Android Studio? For example, I’d like to type a few lines of Kotlin, and use println() or printf() to display output. Adding code to a fragment class init-block and using Log() to display output in the Logcat pane works, but is awkward.

Would it be better to use a more generic IDE such as Eclipse for this purpose?

You can try Kotlin Koans.

Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax.

I’m using Kotlin Koans via the EduTools plugin in Android Studio.

But as far as I can tell, Kotlin Koans doesn’t provide any way to run code. It only compares your source code with its solution, and tells you whether they match.

If what you want is to run some code then you could use Scratch files, which in functionality are very similar to the Kotlin Playground

Thanks :slightly_smiling_face:

I had seen Kotlin Playground. But I didn’t know about Android Studio’s Scratch File feature; it’s perfect for this purpose.

I found that IntelliJ IDEA (Community edition) works better for this purpose.