There are three types of loops available in Swift: the for-in loop, the while loop, and the repeat-while loop.
The for-in loop:
Example:
main.swift91 chars5 linesOutput:
main.swift42 chars4 lines
The while loop:
Example:
main.swift50 chars6 linesOutput:
main.swift10 chars6 lines
The repeat-while loop:
while loop except that it checks the condition at the end of the loop instead of the beginning.Example:
main.swift57 chars6 linesOutput:
main.swift10 chars6 lines
gistlibby LogSnag