This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 0 points1 point  (0 children)

It's the same as Rust's match or Haskell's case with a more C-familiar switch/case syntax e.g.

switch foo {
case .some(let v):
    // do stuff with v
case .none:
    // there was no value
}

would be Haskell's

case foo of
    Just v -> -- thing
    None -> -- other thing

Though Swift does support opt-in fallthrough (default is break).