Language / Errors and assertions

Errors and assertions

Silk favors explicit, typed error modeling (optionals and Result-style return shapes) and uses typed errors (error, panic, T | ErrorType...) for unrecoverable logic bugs and contract violations.

This page focuses on assertions and the high-level model; see typed errors for the full rules.

Full reference: errors.

Example: assert#

fn main () -> int {
  assert (1 + 2) == 3;
  return 0;
}

See also#

Source repository · Edit this page · View Markdown

Quick links

Type to search across the site. Use the up and down arrow keys to choose a result, Enter to open it, and Escape to close.