Looping with for! 5.16 ! HELP please :)


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-XYcN1/3/3?curriculum_id=5059f8619189a5000201fbcb


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

This is the result I keep getting: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950111111111111111111111111111111111111111111111111111..50


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

a = 1
until a <= 50 do
    print a
    a += 1
end


for c in 1..50
   print c
end


#2

You only need 1 loop to pass. It is pretty much your for loop with some touches:

for k in 1..50 do 
   print k
end

That's all you need.


#3

Thanks boss for the help.


#4

Could you mark my answer as the solution? It's a check mark button by the like button. :laughing:


#5

I dont know if that's the solution lol. I just deleted the other loops, in the codeacademy lesson plan though I haven't seen a do in a for loop.


#6

No problem... :smirk: It's kinda just so people know that you solved it and they don't have to click on it...


#7

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