Tin

Examples · learn/25-js-interop · 280 of 339

throws

examples/learn/25-js-interop/throws.tintin run examples/learn/25-js-interop/throws.tin
import js "./shapes.mjs"

extern fn root(n: float): Result<float, string>   // a JS throw becomes Err(message)

fn main() {
  print(root(16.0))
  print(root(-4.0))
}