-
[Ruby] switch 역할을 할 때,,coding for food 2022. 8. 25. 12:40
secret_word = "kitty" guess = "" guess_count = 0 guess_limit = 3 out_of_guesses = false while guess != secret_word && !out_of_guesses if guess_count < guess_limit puts "enter guess: " guess = gets.chomp() guess_count += 1 else out_of_guesses = true end end if out_of_guesses puts "you lose" else puts "you won!" end