Looping with "For"


#1

In the chapter 5, topic - 16 Looping with "For":

Now print out the numbers from 1 to 50 inclusive, using a for loop instead of an until loop.

My code:
i = 1
while i <= 50
print "#{i}"
i+=1
end

nov = 1
for nov in 1..50
print "#{nov}"
nov += 1
end

Output:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849501..50

Error Shown:
Oops, try again. It looks like you didn't print out the numbers 1 to 50, inclusive.

I would like to know, what is inclusive? please help me in correcting the code.


#2

Hello,
Have you tried printing just nov rather than "#{nov}"

Hope it works


#3

I tried using nov instead "#{nov}". Same error.

Thanks,
Bharathi Kannan Kumarasamy


#4

Your code seems to work, you just need one loop (since they're asking 1 to 50, not 1 to 50 twice).


#5

@arjofocolovi thank you..