Number Guessing Game
print "=== Number Guessing Game ===";
print "I'm thinking of a number between 1 and 100.";
let secret = random_int(1, 100);
let attempts = 0;
let guessed = false;
while guessed == false {
let input = input("Your guess: ");
let guess = int(input);
attempts = attempts + 1;
if guess < secret {
print "Too low!";
} else {
if guess > secret {
print "Too high!";
} else {
guessed = true;
}
}
}
print "";
print "Correct! You got it in #{attempts} attempts!";
print "The number was #{secret}.";