MMTMMT Docs
Diagnostics

P024

match expression arm takes an expression, not a block

P024

An expression-form match arm must be a single expression. Remove the braces or move the match into statement position.

Failing example

script "conf"

data chart = subscribe(data.ohlcv)

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

state x: float = 0.0

on chart.update {
  x = match 1 {
    1 => { 2.0 }
    _ => 3.0
  }
  out.plot(x)
}

Corrected example

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

On this page