zip<U> abstract method

  1. @useResult
Option<(T, U)> zip<U>(
  1. Option<U> other
)

Returns a tuple of both this and other if both are Some, or None otherwise.

Examples

// prints "Some((2, some))"
print(const Some(2).zip(const Some('some')));

// prints "None"
print(const Some(2).zip(const None<String>()));

Implementation

@useResult
Option<(T, U)> zip<U>(Option<U> other);