Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For the second return to work doesn't the if have to be an expression i.e return the result of evaluating either y or z as the result of the if expression? If the language has if statements like say Javascript then it won't work.


Yes. And that is why statement–expression distinctions are stupid, because they obscure these relationships. In C-land it would be “if-else” vs. “?:”.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: