 # Parenthesis around conditional expressions

So, I’ve started working on conditional expressions. These are conditions that return a result. Since there is a lot of confusion potential, I’m placing a few restrictions on those.

1. Conditional expressions must have an `else` clause. This is obvious if you think of it: since the expression must have some value always, we must have a value if the condition is `false`.
2. Conditional expressions’ body must be enclosed in curly braces. This time, the purpose is readability.
3. Conditional expressions used in a bigger expression must be surrounded by brackets.

Point #3 is, actually, a result of parsing convenience, but I’m thinking of keeping it.

To duplicate the example given in the issue, the following, where the conditional expression is alone on the line, is fine:

``````def chain( number : U64 ) -> U64 {
if( numer%2 == 0 ) {
number/2
} else {
number*3 + 1
}
}
``````

The following, where it is used with further operators, is also fine:

``````def chain( number: U64 ) -> U64 {
( if(number>12) {number} else {12} ) + 5
}
``````

But the following is not:

``````def chain( number: U64 ) -> U64 {
if(number>12) {number} else {12} + 5
}
``````

While that restriction actually came from the difficulty of (efficiently) parsing that statement, when I actually got to look at it, I like the result. I think example #2 above is much easier to read than #3. My only thought is that rule #2 above might be unnecessary at this point. I.e. - the following might also be readable enough:

``````def chain( number: U64 ) -> U64 {
( if(number>12) number else 12 ) + 5
}
``````

So, what do everyone think?