Expanding What's Allowed for `where` in a for-in loop?

This seems like healthy competition to me.

case _ where let id = Int(id), (40000..<50000).contains(id):
case _:
  guard let id = Int(id), (40000..<50000).contains(id) else {
    fallthrough
  }

More than one "case _:"s yield the following warning, regardless of what you do in those cases, and fallthrough skips the logic of the next case, so this is as much a missing feature with switch as it is with for.

Case is already handled by previous patterns; consider removing it

1 Like