XO0162: `else` must be on the line of the closing brace
Because a newline after } ends the if statement (core 1.3), an else on the next line would start a new statement. Write } else { and } else if on the same line as the closing brace. See core 1.3.
Example
fn f(a: Bool) -> Int {
if a {
1
}
else {
2
}
}Fix
fn f(a: Bool) -> Int {
if a {
1
} else {
2
}
}Run xo explain XO0162 for this text in a terminal, or see
section 10.6 of the specification.