--- id: fn-is_err name: is_err category: builtins kind: builtin tokens: is_err sig: is_err(r: result) -> bool tip: True when a result carries a failure. order: 15 --- Tests a result's tag: true when it was built with err, false when it was built with ok. Use it to detect the failure case explicitly — for example to count or log failures — while try/else handles recovering a value. It is the exact negation of is_ok. Parameters: - `r` — the result to test ```ludic program Retry { function step(n: int) -> result { if n < 3 { return err("not ready") } return ok(n) } test "is_err detects the failure case" { expect(is_err(step(1))) expect(not is_err(step(5))) } } ```