# 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

```xo
fn f(a: Bool) -> Int {
  if a {
    1
  }
  else {
    2
  }
}
```

## Fix

```xo
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](../../spec/core/#106-diagnostic-codes).

