Stage 5.4: Option
Rust has a built in generic enum called Option<T>
that allows us to represent
nullable values without using null
.
Option<T>
has the 2 values None
and Some(T)
This enum is so common, instances of the enum can be created anywhere with the enum variants Some
and None
.
Further information: