Pls help me with Looping with 'While'


#1

how do I turn this into a_ 50 _

i = 5
while i > 3 do
print i
i -= 1
end

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

ps im kind of bad with math :expressionless:

this = 54nil, but I need 50nil :frowning: pls help


#2

If you are in the exercise 14. Looping with 'While' the answer is this:

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

ATENTION!! -> I used 'num' for the name of my variable but you can use whatever the name you want! Also pay atention to this! If you use puts it will end in error! You have to use print because the instruction is telling you to do like that. :smile:


#3

If I is counting on 1 and looping until 50.
You need to initialized I at 1 .
then have your while loop stop at 50
Incremental statement counting a + 1 every time.:grinning: