I'm *assuming* that you're actually worried about the fact that your conditional isn't outputting anything. Unless you're post was a typo, you mean to use "elsif" instead of "elseif"...
On Apr 25, 11:13 am, Chris Bird <[email protected]> wrote: > For many the observation that every operation in Ruby returns > something - the primary effect, and it may do something else (a side- > effect) is rather strange. So for example, we want the side-effect > "put the stuff out to the printer" when we invoke puts and usually > don't care about the returned value (nil). > > It is pretty important to separate what is returned from what it does. > Sometimes they are the same (almost!), however. So == does indeed > compare two comparable values, and it returns the result of that > comparison (true or false). > > On Apr 23, 2:45 pm, Frederick Cheung <[email protected]> > wrote: > > > On Apr 23, 8:07 pm, DrV <[email protected]> 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 > > > I assume you've got elsif rather than elseif (which doesn't exist ) or > > else if, which isn't the same. > > > > This returns nil. > > > puts always returns nil. > > > Fred- Hide quoted text - > > > - Show quoted text - > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

