![]() | Single Line Conditionals |
|
15 Oct 2012, 23:08
Keith R. Bennett (1 post) |
Regarding p. 129, if and unless expressions, I recommend pointing out that single line conditionals can also be accomplished with the semicolon, e.g: if true; puts 'true'; end
Although it requires end, while the form: puts 'true' if true
...does not, it can be clearer to the reader. (For a more detailed argument, see my blog article “Stealth Conditionals in Ruby” at http://www.bbs-software.com/blog/2012/09/16/ste…) - Keith Bennett |
| You must be logged in to comment |

