Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Ternary Usage
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Michael Fellinger, post: 4578832"] The ternary operator is not used very often, Ruby offers a different way to do what you try. do_stuff if test do_stuff unless test are both valid forms. You cannot omit the third parameter from the ternary (that's why it has this name, after all) So if you want to make it work you have to: test ? do_stuff : nil Hope this helps, more information on the ruby quickref: [URL]http://www.zenspider.com/Languages/Ruby/QuickRef.html[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Ternary Usage
Top