DrV wrote: > I've been working on a new project and created a custom method for one > of the models. Nothing major. > > I brought up the console in --sandbox mode (also have tried in > standard console), and tried playing with it. To my surprise there > was a problem with the if/elseif conditional. The elseif portion > simply would not work. So I tried a couple commands as so to test the > actual if/elseif integrity like so: > > person = "Jim" > if person == "Sally" > puts "Hi Sally" > elseif person == "Jim" > puts "Hi Jim" > end > > This returns nil. If I put a final <else> catch it will return that > value. What am I doing wrong?
1) Your code produces an error in all versions of Ruby. 2) Never use irb like interfaces in any programming language, and you will avoid a lot of confusion and you will never lose your work and you won't have to retype anything. Instead open up a test program and run your code from the command line. 3) What does puts "hello world" return for you? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

