MMTMMT Docs
Diagnostics

P023

match arm body statement requires a block

P023

A statement-form match arm needs a brace-delimited block. Wrap the arm statements in { ... }.

Failing example

script "conf"

data chart = subscribe(data.ohlcv)

plot out = plot.line(title: "out")

on chart.update {
  match 1 {
    1 => let y = 2.0
    2 => return
    _ => out.plot(3.0)
  }
}

Corrected example

script "fixed"
data chart = subscribe(data.ohlcv)
on chart.update { match 1 { 1 => { let value = 1 }
  _ => { let value = 0 } } }

On this page