Sha256: 40f85d968004f4343161c10a7e3ea9dbc53c3d1d12cc9c0f8156be63f8535e20
Contents?: true
Size: 408 Bytes
Versions: 1
Compression:
Stored size: 408 Bytes
Contents
def getInput:int s = System.console.readLine() Integer.parseInt(s) end number = int(Math.random() * 10 + 1) puts "guess the number between 1 and 10" guessed = false while !guessed do userNumber = getInput if userNumber == number guessed = true puts "you guessed it" elsif userNumber > number puts "too high" else puts "too low" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.0.8-java | examples/rosettacode/guess-the-number.mirah |