Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
perfunctory
on Jan 2, 2012
|
parent
|
context
|
favorite
| on:
Reducing Code Nesting
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
on Jan 2, 2012
[–]
There is an 'if' expression, it's just spelled '?' and else is ':'. Mentioned a few posts up.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
return if condition() 10 else 20
I am not sure this is more readable though.