MMTMMT Docs
Diagnostics

T212

not all code paths return a value

T212

A value-returning function has a control-flow path that reaches the end. Return a value on every path.

Failing example

script "example"
fn value(flag: bool) -> int { if flag { return 1 } }

Corrected example

script "fixed"
fn value(flag: bool) -> int { if flag { return 1 }
  return 0 }

On this page