Way to break out of an inner For loop in Swift -


is there simple way break out of inner loop, i.e. fro loop within loop? without having set additional flags example

there 3 basic methods:

  1. using additional boolean flag

  2. using labelled loop (label: ...) , break label

  3. extracting loops separate function/method , using return instead of break.

from code quality perspective believe 3. best solution.


Comments