2 ms·
Here's a variant of that ternary chain, used in Perl Best Practices: sides[i] = dot < -LIGHT_CLIP_EPSILON ? SIDE_BACK : dot > LIGHT_CLIP_EPSILON
by rjh29 14y ago
Here's a variant of that ternary chain, used in Perl Best Practices:
sides[i] = dot < -LIGHT_CLIP_EPSILON ? SIDE_BACK
: dot > LIGHT_CLIP_EPSILON ? SIDE_FRONT
: SIDE_ON
;
This is a little cleaner if your values are longer, and has slightly nicer diffs if you add conditionals.
Note that this won't work in many languages whose ternary operator precedence is different (PHP comes to mind).