4 ms·
I don't think there is anything at all unclear about (a ? b : c). I use it all the time when programming in C and its derivatives. The (a and b or c) idiom is
by tomlu 14y ago
I don't think there is anything at all unclear about (a ? b : c). I use it all the time when programming in C and its derivatives.
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.