liveBook · Manning

Option

Also called optional, Maybe

An option type is a type that represents either a value of a specified type or its absence as distinct alternatives.

How 12 Manning books explain it

Functional Programming in C#, Second Edition

An option type represents either the presence of a value or its absence through distinct alternatives such as Some and None.

How it is used
Models optional data and results that may be unavailable, making absence explicit in properties and function signatures.
How deep it goes
Develops an Option implementation, including matching and conversions, before presenting a struct-based alternative.
Examples
Uses integer parsing, collection lookups, and a subscriber greeting whose name becomes optional.
What you can do after
Apply it via LaYumba.Functional to model absence, match alternatives, and compose optional results.

Read how Functional Programming in C#, Second Edition explains option →

F# in Action: A Revised Edition of Get Programming with F#

An option is an F# generic discriminated union representing either the presence of a value with Some or its absence with None.

How it is used
Models values that may be absent in domain data, searches, parsing, and .NET interop.
How deep it goes
Defines both union cases, works through matching and mapping, and gives boundary guidance without detailing option implementation internals.
Examples
Uses present and missing integers, an optional customer’s age, collection searches, and a TryParse wrapper.
What you can do after
Apply it via F# option functions to handle missing values explicitly and convert nullable data at .NET boundaries.

Read how F# in Action: A Revised Edition of Get Programming with F# explains option →

Functional Programming in Scala, Second Edition

Option is a Scala standard-library type representing either the presence of a value with Some or its absence with None.

How it is used
Models expected absent or undefined results as values instead of exceptions or sentinel values.
How deep it goes
Defines Option’s cases and operations, then develops lifting, combination, traversal, and its Applicative-versus-Monad distinction.
Examples
Uses empty-sequence mean and variance, employee lookup, integer parsing, insurance quotes, and dependent Map lookups.
What you can do after
Apply it via Scala Option operations to compose missing-value computations, combine inputs, and wrap parsing failures.

Read how Functional Programming in Scala, Second Edition explains option →

Data-Oriented Programming in Java

Optional is the Java container class that represents either a present non-null value or the absence of a value.

How it is used
Models lazily created domain values, especially approvals whose absence changes the assessment outcome.
How deep it goes
Descends from presence checks and transformations to lifted algebra, but defers proving the resulting properties.
Examples
Uses customer approvals, uppercase defaults, generic Optional arguments, and lifted policy, finding, and status operators.
What you can do after
Apply it via map, orElse, isEmpty, get, Optional.of, and lifted operators to represent absence and compose behavior.

Read how Data-Oriented Programming in Java explains option →

Functional Programming in JavaScript

A monadic type that represents an optional value, distinguishing presence from absence without using null directly.

How it is used
Consolidates null-check logic and supports compositional functional error handling without direct null or undefined branching.
How deep it goes
Defines Just and Nothing, demonstrates mapping and defaults, and stops short of detailing the complete monad API.
Examples
Uses nullable student lookups, nested school addresses, DOM-style defaults, and database records wrapped as Just or Nothing.
What you can do after
Apply it via mapping and getOrElse to compose nullable lookups and provide explicit fallback values.

Read how Functional Programming in JavaScript explains option →

Rust Servers, Services, and Apps

Option is a Rust standard-library generic type representing either a value or its absence.

How it is used
Models fields that may be absent across API payloads and database records with different requiredness.
How deep it goes
Explains optional struct fields and nullable database columns, but does not develop Option’s broader API or internals.
Examples
Uses Course, CreateCourse, UpdateCourse, and nullable course-table columns to demonstrate optional values.
What you can do after
Apply it via Rust data models that distinguish required fields from values accepted as absent.

Read how Rust Servers, Services, and Apps explains option →

The Coder Cafe

Maybe is a Haskell type representing either an absent value or a present value of a specified type.

How it is used
Represents possible absence while demonstrating how functions transform values inside a context.
How deep it goes
Works through mapping, wrapped functions, and optional results, then diagnoses an applicative type mismatch without completing the greeting implementation.
Examples
Uses mapping over Just and Nothing and an age-gated greeting expression that fails to type-check.
What you can do after
Apply it via Haskell Maybe, fmap, and <*> to transform optional values and recognize incompatible function arguments.

Read how The Coder Cafe explains option →

Learn Rust in a Month of Lunches

How it is used
Uses Option to represent expected absence without treating it as an error.
How deep it goes
Explains the generic enum, handling both variants, panic risks, and chaining methods with worked examples.
Examples
Uses a fifth-vector-item lookup and a chain that parses strings into characters.
What you can do after
Apply it using Rust’s Option to return and handle a potentially absent value.

Read how Learn Rust in a Month of Lunches explains option →

Server-Side WebAssembly

Option is Rust's enum type for representing either a present value or the absence of a value.

How it is used
Models possibly missing key-value lookups across Rust host and JavaScript guest component boundaries.
How deep it goes
Works through a HashMap lookup, WIT signature, generated TypeScript mapping, and the runtime failure risk of assuming presence.
Examples
Uses a SmartCMS kvstore get operation, a guest-hello value, Rust Option<String>, and a generated string | undefined declaration.
What you can do after
Apply it via WIT by declaring option<string> and returning a Rust HashMap lookup without unwrap.

Read how Server-Side WebAssembly explains option →

Functional Design and Architecture: Examples in Haskell

The Maybe type is an algebraic data type representing either an optional value or the absence of a value.

How it is used
Models optional and potentially failing results while composing functional operations over lists, lookups, and extracted values.
How deep it goes
Defines Just and Nothing, demonstrates fmap over nested structures, and refactors nested pattern matching with monadic do notation.
Examples
Uses optional names, nested fmap, database user lookup, name extraction, and initial-letter construction.
What you can do after
Apply via fmap and do notation to transform and sequence computations that may produce Nothing.

Read how Functional Design and Architecture: Examples in Haskell explains option →

Code Like a Pro in Rust

How it is used
Represents possibly absent boxed data and terminates links in a singly linked list.
How deep it goes
Explains `None` as a safe absence marker and demonstrates checking optional links, without detailing the type’s internals.
Examples
Demonstrates an optional next link initialized to `None` and traversed by checking for `Some`.
What you can do after
Apply it to represent absent heap-allocated values and safely traverse optional list links.

Read how Code Like a Pro in Rust explains option →

100 Java Mistakes and How to Avoid Them

Optional is a Java standard-library container type representing either a present non-null value or an empty state.

How it is used
Uses Optional to signal possibly absent return values and reduce NullPointerException risk.
How deep it goes
Defines empty and non-empty states, factory methods, fluent transformation, and parameter guidance, but does not detail implementation internals.
Examples
Uses a user-search result, Optional.empty(), Optional.of(), Optional.ofNullable(), map(), and orElse().
What you can do after
Apply Optional through its factory and transformation methods when absence belongs in a return value.

Read how 100 Java Mistakes and How to Avoid Them explains option →

Also covered in

What to know first

Related concepts

Questions about option

What is option?

An option type is a type that represents either a value of a specified type or its absence as distinct alternatives.

Which Manning books explain option?

Functional Programming in C#, Second Edition, F# in Action: A Revised Edition of Get Programming with F#, Functional Programming in Scala, Second Edition, Data-Oriented Programming in Java, Functional Programming in JavaScript, Rust Servers, Services, and Apps, The Coder Cafe, Learn Rust in a Month of Lunches and 4 more.

What should I know before learning option?

Manning books that teach option usually introduce attribute, missing value, string and exception first.

What is option a kind of?

Option is a kind of functor. A functor is an abstraction that maps values or objects while preserving the structure and relationships of their surrounding context.

What are the parts of option?

Option includes none and some.

What is option also called?

Option is also called optional or Maybe.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.