So I'm learning ruby, and I have a script that I'm working on. It's supposed to ask your name and for a number, and determine if the number is even or odd. If its even, it will print a message saying so. If it's odd, it will ask for another number. However, if you put an odd number, then try to enter an even number, it will go through an endless loop of asking for another number. Any help is appreciated! Code:
name = ask "What is your name?"
num = ask name + ", " + "Enter a number"
sumNum = num % 2
while(sumNum != 0)
num = ask "Pick another number"
end
puts name + " picked an even number!"