Reputation: 8793
If the user types anything other than a number, and any number besides a number in range of 1 - 32, I need it to ask for input again.
It's giving me an error when I use if cut_number in 1..32
def cut_the_deck
puts "You get to cut the deck to make it even more random!"
puts "Type a number between 1 and 32. That's where the deck will be cut!"
cut_number = gets.chomp
cut_number = cut_number.to_i
if cut_number in 1..32
puts "Number in range"
else
puts "Number NOT in range"
cut_the_deck
end
end
Upvotes: 1
Views: 863