jeudi 5 novembre 2015

RUBY: If/Else statement that creates a loop

I am looking for the proper way to do this in Ruby. I want to create an if/else statement that will keep looping until it finds the right answer. Example: puts "Guess a number",prompt $stdin.gets.chomp = x if x == 5 puts "correct else # loop back to beginning and start over end

Aucun commentaire:

Enregistrer un commentaire