Nulls
Jump to navigation
Jump to search
Because we don't have null, we need null.
type Null union <
Elem interface{}
> [
Null struct{}
Value Elem
]
var foo Null<int> = Foo()
if foo.Null? {
return foo
}
// at this point, the compiler knows that foo must be case Value
// so in this instance, i now has a type of int
return i*20