From: Greg Willits Date: 2007-10-07T03:27:46+09:00 Subject: Ternary Usage New to Ruby. Having trouble with ternary statements. I am used to a language that allows these two forms: test ? trueStuff test ? trueStuff | falseStuff While I have yet to find a reference that explicitly states this, it would appear that ternary statement in Ruby is not allowed to exclude the :, as without it I get an "unexpected '\n'" error statement. Ok, fine, so I can write something like this: $debug ? $devLog.info("bla bla bla") : That's working for most cases, however, whenever such a line appears in IF statements, it generates another set of errors. if (...whatever...) ...do some stuff... $debug ? $devLog.info("bla bla bla") : else ...do other stuff... $debug ? $devLog.info("yadda yadda") : end I get "unexpected kELSE" and "unexpected kEND" syntax errors. Hard to comprehend what can be so tricky about a simple ternary statement. Indeed it is assumed to be so simple that the Programming Ruby book offers no details for its use, yet clearly there are some rules that need to be followed. Any enlightment is appreciated. TIA. -- greg willits -- Posted via http://www.ruby-forum.com/.