langatator/examples/guessing.ltor

24 lines
449 B
Text
Raw Permalink Normal View History

2022-05-16 09:02:04 +00:00
set i to 0
set toGuess to random_int(0, 100)
while 1 do
set guessed to input_number()
if i > 20 then
# do you really want to continue?
break
end
if guessed = toGuess then
# success
print_ascii(83)
break
end
if guessed < toGuess then
# too low
print_ascii(76)
end
if guessed > toGuess then
# too high
print_ascii(72)
end
set i to i+1
end