3 ms·
>The else branch must be present, if it's missing you will get a syntax error this is to make sure that all of the possibilities are covered Is there itsokay s
by wruza 8y ago
>The else branch must be present, if it's missing you will get a syntax error this is to make sure that all of the possibilities are covered
Is there itsokay statement to pacify the compiler more?
- always_good 8y agoIf if/else is an expression, what would be the return type of `if (true) { 42 }`?
- klibertp 8y agoint option which is basically a variant/union like this: Result of 'a | Void You could also have a `discard` or `ignore` function/operator, which can swallow every type, so it doesn't matter what it was. Some languages actually require you to use such operators, for example, Nim and F#.