Switch fallthroughs

suggest change

It is worth noting that in swift, unlike other languages people are familiar with, there is an implicit break at the end of each case statement. In order to follow through to the next case (i.e. have multiple cases execute) you need to use fallthrough statement.

switch(value) {
case 'one':
    // do operation one
    fallthrough
case 'two':
    // do this either independant, or in conjunction with first case
default:
    // default operation
}

this is useful for things like streams.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents