Optional Pointers and ?*T
Combine pointers with optionality.
Pointers Can Be Optional Too
A pointer normally must always aim at a valid value. Make it optional and it gains a legitimate way to mean nothing yet.
The ?*T Shape
The type ?*T reads as: an optional pointer to a T. It either points at a real value or holds null.
var node: ?*Node = null;All lessons in this course
- Declaring Optional Types
- Unwrap Safely with if and orelse
- Optional Pointers and ?*T
- null Versus undefined