in java I can handle a loop and stop the loop with a condition in 1 line statement.
boolean continue=true;
for (int i=0;i<100 && continue;i++){ // <------ 1 line
Is this also possible in swift and when how ?
in java I can handle a loop and stop the loop with a condition in 1 line statement.
boolean continue=true;
for (int i=0;i<100 && continue;i++){ // <------ 1 line
Is this also possible in swift and when how ?
Yes you can do the same but in swift continue is a key word so replace it with something different:
var cont = true
for var i = 0; i < 100 && cont; i++ {
println("Value: \(i)")
if i == 20 {
cont = false
}
}