Honoring Asian Pacific American Heritage Month. See how.

or method

T or (T fallback)

If the value is Some, the value is returned. If None, null is returned. Otherwise, the value isUndefined, in which case the given fallback value is returned instead.

Implementation

T? or(T? fallback) {
  if (isDefined) {
    return _value;
  } else {
    return fallback;
  }
}