Examples · learn/25-js-interop · 280 of 339
throws
tin run examples/learn/25-js-interop/throws.tinimport 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))
}