The method “gets” always returns a String, so your variable number_one
is a String, not a Fixnum. If you enter 1, you’ll get “1”.
When you do the comparison number_one == 1, that means “1” == 1, which
is false.
Try this line instead of gets.chomp:
number_one = Integer(gets)
number = gets.chomp.to_i
case number
when 1
puts “You picked 1!”
when 2
puts “You picked 2!”
when 3
puts “You picked 3!”
when 4
puts “You picked 4!”
when 5
puts “You picked 5!”
else
puts “The first number was not between 1 and 5!”
end
or more elegant
number = gets.chomp.to_i # <-- this convert your string to integer
case number
when 1; puts “You picked 1!”
when 2; puts “You picked 2!”
when 3; puts “You picked 3!”
when 4; puts “You picked 4!”
when 5; puts “You picked 5!”
else
puts “The first number was not between 1 and 5!”
end