Option

Noun · Development

Definitions

  1. A sum type (called `Option<T>` in Rust, `Optional<T>` in Java/Swift, and `Maybe a` in Haskell) that explicitly represents the presence (`Some(value)`) or absence (`None`) of a value in the type system, forcing callers to handle the missing case at compile time instead of risking null pointer exceptions at runtime.

    In plain English: A wrapper type that safely represents 'either there's a value here, or there isn't' — forcing you to check before using it.

    Example: "The function returns Option<User> — if the ID doesn't match anyone, you get None and the compiler makes you deal with it."

Related Terms