Looping With While - exercise 14


Question : Use a while loop to print out the numbers 1 through 50, inclusive. While the example above counts down, you will want to count up.

Use print rather than puts, and don't forget to increment your variable.

My answer :
i = 1
while i < 51 do
puts i
i += 1

Ruby prints out from 1 to 50, inclusive.
But it doesn't accept my answer saying : Oops, try again. It looks like you didn't print out the numbers 1 to 50, inclusive..

Please help....


Hi Birce,

Look at the instructions, specifically:

Use print rather than puts

And line 3 of your code:

puts i

Change puts to print, and it'll pass you.
Following the instructions is important :)