Kotlin Script kotlin-experiment/Play.kts
import experiment.*
println(sum(2, 2))
Kotlin Library kotlin-experiment/Play.kts
package experiment
fun sum(x: Int, y: Int) = x + y
The compile and run command:
kotlinc -script Play.kts
produces an error:
Play.kts:3:9: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
...
println(sum(2, 2))
^