The ALTernative Language
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Optional

You can ‘mark’ any value to be optional with the (postfix) option ? operator. An optional pair that is contained in a struct doesn’t show up in the output and cannot be indexed. A pair is considered optional if its key or value is optional.

The intersection of two optional values yields another optional value (that is, the intersection). Optionality is dropped when either one of the two values is optional.

Optional values