3 ms·
I don't understand your example, `isSet` is always true and can never be false. Missed something?
by 1_player 5y ago
I don't understand your example, `isSet` is always true and can never be false. Missed something?
- hmmdar 5y agoThe only time `IsSet` would be false is when `NewOption` was not used to initialize the value. e.g. var o Option[int32] or could have `None` helper func None[T any]() Option[T] { return Option[T]{} } o := None[int32]()
- gnulinux 5y agoIt works because it's false when uninitialized (as default value). So if not initialized it represents Nothing value. When it is initialized it's Just T.