Conditional Statements
The syntax of conditionals (if statements) and matches is fundamental for the look-and-feel of a language.
Other languages
C
if (condition) statement1; else statements;
if (condition)
{
statement1;
}
else if (condition1)
{
statements;
}
else
{
statements;
}
Problems:
- parentheses around conditions not needed
- ambiguity for nested if-statements to find matching else:
if (a) if (b) stmnt1; else stmnts2;
Which if does the else clause belong to?
Rust
if-let and else-let syntax. Examples?
MLscript
A paper suggests a powerful syntax for conditionals in MLscript.