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
i -= 1
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