I have a static list defined in my project. Like t...
# getting-started
d
I have a static list defined in my project. Like this:
Copy code
val obj1 = MyDataObj(1,3,4)
val obj2 = MyDataObj(3,2,3)
val obj3 = MyDataObj(2,4,1)
val list = listof(obj1,obj2,obj3)
using AndroidStudio/IntelliJIdea, is it possible to run a script, where I experiment a reduce function, without having to run the whole project, but just this script which references an objected defined in my project? In other words, can I run my “playground” inside my IntellijIDEA, which references classes already defined in a projects? I would like to run something like this
Copy code
println(list.sumBy{ it.a })
n
you could write a unit test and just run the one test
if this were vanilla Kotlin (not Android) you could create a
fun main()
and run that
the Kotlin REPL would work
👍 1
and...lastly, you can create a Scratch File and that should be runnable
🙌 1
👍 1
d
great! I didn’t know about Scratch Files, I just found out!
thanks
👍 1