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

> In functional languages, however, where everything is an expression that has a value, the else block (or its equivalent) is mandatory. You simply cannot have an empty or missing else block. (Further, in languages with strict type systems, the else block has to have the same type as the if block, typically.)

The else clause is also mandatory in C, java, ... in if-expressions:

    int foo = <test> ? <then-clause> : <else-clause>;
They even have to have the same type!


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

Search: