Odd Ruby Error
-
I am using the RDE to make my SU Ruby script. I got a strange issue today: elseif was not a recognized keyword in the RDE but is listed in the ruby documentation. I could not get the code to run until I made nested if/then/else/end blocks. Anyone else seen this?
Chris
-
try elsif
Todd
-
I had this same problem a while ago. This seems to be a weird feature of Ruby where the elsif statement differs from most other programming languages. This is one case where Ruby breaks the "Principle of Least Surprise" that everyone seems to praise it for.
See this article for a tutorial on Ruby conditionals: http://www.math.umd.edu/~dcarrera/ruby/0.3/chp_02/conditionals.html
-
Thanks Todd! I never could have imagined that the spelling was different!!!! I REALLY feel stupid now.....................
Advertisement