Pacific-Design.com

    
Home Index

1. Scala

2. User Input

Scala / User Input /

Get User Input


//---------------------------------------------------------
// readInt 
// readDouble 
// readByte 
// readShort 
// readLong
//---------------------------------------------------------
object UserInput {

    def main(args: Array[String]) {

        var guessNumber = 0

        do {

            print("Guess a number: ")
            guessNumber = readLine.toInt


        } while (guessNumber != 7)

        printf("Correct: %d\n", guessNumber )
    }
}