Why REPL prints functions calls

The interpreter prints the function call instead of just the result:

Welcome to Kotlin version 1.6.10 (JRE 17.0.1+12-LTS-39)
Type :help for help, :quit for quit
>>> println("Apple")
1 Like

REPL cell always returns the result of the last expression and prints it. If you call println, it should pring the argument and then return the result of println itself which is Unit and print it as well. Not sure why it prints the input though.

If I am not mistaken, Kotlin REPL is being deprecated in favor of GitHub - Kotlin/kotlin-interactive-shell: Kotlin Language Interactive Shell

1 Like