Wu Language
Search
K
Comment on page

Optionals

Optional variable types are types that are allowed to contain a nil values:
foo: int? = 10
foo = nil
foo = 100
Optional types are denoted by a ?
We can safely unwrap an optional value, given that it exists, using !like this:
foo: str? = maybe_a_str()
bar: str = foo!