Reputation: 494
for x in 1..10
print "Enter a number: "
numbers << gets.chomp
end
print numbers.max
In my following code if I were to enter the numbers 1 through 10, this would display 9. If I were to enter the numbers 50 through 140 incrementing by 10s, it would display 90.
If I enter the numbers 1 through 11 not including 9, it'll display 8.
I'm having an extremely hard time wrapping my head around these results and I'm wondering if anyone can offer an explanation as to why this would be occurring?
Cheers
Upvotes: 1
Views: 43
Reputation: 494
Never mind I figured this out all though it's my hope if people have this issue in the future they find this.
Remember to convert to int
for x in 1..10
clear
print "Enter a number: "
numbers << gets.chomp.to_i
end
print numbers.max
This code above fixes it
Upvotes: 2