by tomlu · 13y ago · 0 comments
arg = a and b or c
foo(arg)In fact, I'd say your "trick" with using boolean operators on non-booleans that way is less readable.
The (a and b or c) idiom is used in Lua, Ruby and Python (in descending order of idiomaticness). Since the person I was responding to seemed to be using syntax reminiscent of these languages, I thought I'd offer up this expression form as an alternative to resorting to statements.