On Tuesday, July 22, 2014 6:33:42 PM UTC-4, [email protected] wrote: > > Sorry, not quite sure what the ? means -- does that mean 'or'? Also not > sure about what you mean by the phrase ternary syntax. >
Sure, the ternary operator — called that because of its three parts — is simply a shorthand for an if-then-else chain. It's a common construct in many languages. Wikipedia has lots to say about it: https://en.wikipedia.org/wiki/%3F%3A In short, it allows you to say things like: testarray > 0 ? do_this() : do_that() I read it is "Is testarray > 0? Then do_this(). Otherwise, do_that()." It's especially nice for inline assignments: x = condition ? value_if_true : value_if_false
