From: Hassan Schroeder Date: 2011-07-23T09:13:28+09:00 Subject: Re: using "puts" in ternary operator On Fri, Jul 22, 2011 at 4:18 PM, Jesse Breuer wrote: > SyntaxError: (irb):3: syntax error, unexpected tSTRING_BEG, expecting > keyword_do or '{' or '(' > x == 2 ? puts "two" : puts "one" >               ^ > (irb):3: syntax error, unexpected ':', expecting $end > x == 2 ? puts "two" : puts "one" I think the lack of parens creates an ambiguous scope for the argument to the initial `puts` whereas your next form doesn't. > x == 2 ? puts("two") : puts("one") Regardless you could DRY it up (without even parens) as puts x == 2 ? "two" : "one" FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan