Wu Language
Search…
Optionals
Optional variable types are types that are allowed to contain a nil values:
1
foo: int? = 10
2
foo = nil
3
foo = 100
Copied!
Optional types are denoted by a ?
We can safely unwrap an optional value, given that it exists, using !like this:
1
foo: str? = maybe_a_str()
2
bar: str = foo!
Copied!
Copy link