Skip to content

Instantly share code, notes, and snippets.

@erica
erica / continue.md
Last active September 21, 2017 10:29

Adding continue to Switch Statements

Introduction

This proposal completes the switch statement's control flow transfer suite by introducing continue. This change adds functionality that many developers expect (but do not get) from fallthrough.

Motivation

At this time, Swift does not allow pattern matching and execution to continue within the scope of the current switch statement. A case can fallthrough to execute the next clause but it cannot resume pattern matching. The fallthrough executes the next case clause regardless of whether the value matches its pattern or not.