secret_word = "giraffe" guess =""
while guess != secret_word puts "Enter guess: " guess = gets.chomp() end puts "You Won!"
secret_word = "giraffe" guess ="" guess_count = 0 guess_limit = 3 out_of_guesses = false
while guess != secret_word and !out_of_guesses if guess_count < guess_limit puts "Enter guess: " guess = gets.chomp() guess_count += 1 else out_of_guesses = true end if out_of_huesses puts "You Lose" else puts "You Won!" end
Recommended Posts