[solved] 8. The loop method in terminal not working

Hello folks,

This one has me stumped… The following code example works when I click the ‘run’ button in the web interface of the class. But I am doing the same thing on my local hard drive by saving this code in a ‘loop_method.rb’ file on my computer. When I execute the file in the terminal (mac os x) with ‘ruby loop_method.rb’ it outputs nothing!

i = 20
loop do
i -= 1
print "#{i}"
break if i <= 0

Why is that? All the previous examples worked…


Update! Sorry about that, it does work! I had to quit and restart the terminal. Something must have gone wrong on my system :frowning_face:

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