small medium large xlarge

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

  • Keith Bennett