How do I create a noop block for a switch case in Swift?

前端 未结 1 1437
南方客
南方客 2021-01-03 17:32

How do I create a noop block for a switch case in Swift? Swift forces you to have at least one executable statement under your case, including default. I tried putting an e

相关标签:
1条回答
  • 2021-01-03 18:04
    default:
      break
    

    Apple talks about this keyword in this article. See here, too.

    Although break is not required in Swift, you can still use a break statement to match and ignore a particular case, or to break out of a matched case before that case has completed its execution.

    0 讨论(0)
提交回复
热议问题