Options
option(T) is either Some(value) or None. Unlike a zero value, it can tell "not set" apart from "set to zero".
options.lithe
(* `option(T)` is `Some(value)` or `None`. Match it with `case`. *)
import "std/evm";
storage is record {
admin : option(address);
}
external function appoint() is {
storage.admin := Some(Evm.sender());
}
external function resign() is {
storage.admin := None;
}
external view function adminOr(const fallback : address) : address is
case storage.admin of {
| Some(who) -> who
| None -> fallback
}
external view function hasAdmin() : bool is
case storage.admin of {
| Some(who) -> true
| None -> false
}- An option must be matched with
casebefore its value can be used. option(address)is one storage slot.Noneis zero, so an unset field reads asNone.- Options work anywhere a value does except the ABI: in maps, lists, tuples, records,
vars, transient storage, and function results. They also compare with=. See where options work. - Options can't cross the ABI. Expose views that return plain values.

