# ok!
Assert that an expression is `%Ok` and unwrap its `:value`; if it is `%Err`,
return from the enclosing function with that Err. Any other value passes
through unchanged.
## Syntax
[ok! $expr] [$expr](ok!)
`ok!` is compiler-intercepted — both forms emit inline opcodes rather than a
function call — so it must appear inside a function body where the
short-circuit return is meaningful. The stub entry only exists for `info` and
completion.
## Examples
def inc-or-fail {|x| if ($x > 100) { [err "too big"] } else { [ok ($x + 1)] } } def go {|x| set v [ok! [inc-or-fail $x]] # on %Err, go returns immediately ($v * 10) } [go 4] # → 50 [go 200] # → %Err{:message "too big"}
## Returns
The `:value` inside an `%Ok`; on `%Err`, the enclosing function returns the Err
immediately. Non-Result values pass through unchanged.
## See Also
`err!`, `ok`, `err`, `unwrap`, `and-then`