When we use a switch statement in traversal, we sometimes need to terminate the entire traversal rather than the switch statement, so the implementation of the label statement is necessary.
//Tags can be used to mark a loop body or switch code block, when using break or continue with this tag, you can control the label represents the object's terminal or execution, suitable for complex real control process/*requires that the loop be terminated directly when the exception data is encountered*/var score= [ the, the, +,101, the, -,-5, About]first: forSinchScore {//Define label first Switchs/Ten{ Case Ten: ContinueFirst//Using Labels Case 9: println ("\ (s) divided into excellent") Case 8: println ("\ (s) divided into good") Case 8: println ("\ (s) divided into medium") Case 0: BreakFirst//use the label to terminate the For loop, if the label is not used here, the break will be Swit default: println ("\ (s) divided into failed") }}
Perhaps the code and language description of the advantages of abstraction, if not clear can be copied down with no label for a comparison
Label statements in the SWIFT switch statement