// Game.kt Copyright (c) Kari Laitinen // http://www.naturalprogramming.com // 2018-10-28 File created. /* This is a simple Kotlin program that can be run, for example, in a Command Prompt Window in Windows. After changing to the right directory in the Command Prompt window, you can compile this program with the command c:\freeware\kotlinc\bin\kotlinc Game.kt -include-runtime -d Game.jar In the above command the whole path to the compiler is written as it is not put into the Path variable. After compilation, the program can be run with command java -jar Game.jar More information at https://kotlinlang.org/docs/tutorials/command-line.html */ fun main() { print( "\n This program is a computer game." + "\n Please, type in an integer : " ) // The next statement reads a line from keyboard, and converts // the string of characters to an Int value. val given_integer = readLine()!!.toInt() val winning_integer = given_integer + 1 // Here we use two alternative ways to join the value of a // variable to a string. print( "\n You typed in " + given_integer + ". " ) print( "\n My number is $winning_integer. " ) print( "\n Sorry, you lost. I won. The game is over.\n\n" ) }