3 ms·
if `if` was an expression rather than a statement one could write return if condition() 10 else 20 I am not sure this is more readable though.
by perfunctory 15y ago
if `if` was an expression rather than a statement one could write
return if condition()
10
else
20
I am not sure this is more readable though.
- marshray 15y agoThere is an 'if' expression, it's just spelled '?' and else is ':'. Mentioned a few posts up.