Help needed with while condition


#1

What is wrong in this code?

It doesn't print out numbers from 1 to 50 inclusive


i = 50
while i > 0 do
    print i
    i = i+ 1
end


#2

Hi here

while i > 0 do

i will Always be great than 0 you should make some change in this line


#3

Or in this line :slight_smile:


#5

Okay! Guess I got it.

Thanks a lot for the help

the change is

i = 1
while i <= 50 do
    print i
    i += 1
end

#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.