4 ms·
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 t
by rohitarondekar 12y ago
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.
- evincarofautumn 12y agoYes. And that is why statement–expression distinctions are stupid, because they obscure these relationships. In C-land it would be “if-else” vs. “?:”.