Question : Swift break statement with for loop
Answered by : samer-saeid
for i in 1...5 { if i == 3 { break }
print(i)
}
Source : | Last Update : Thu, 23 Jun 22
Question : Swift break with while Loop
Answered by : samer-saeid
// program to find first 5 multiples of 6
var i = 1
while (i<=10) { print("6 * \(i) =",6 * i) if i >= 5 { break } i = i + 1
}
Source : | Last Update : Thu, 23 Jun 22