-
-
Notifications
You must be signed in to change notification settings - Fork 8
Continue Statement
IsaacShelton edited this page Mar 21, 2022
·
1 revision
The continue
keyword is used to jump back to the start of a loop
for(i usize = 0; i < 5; i++){
if i == 3, continue
print(i)
}
0
1
2
4
5
A specific loop can be specified using loop labels
each outer_loop : enemy Enemy in enemies {
each stat Stat in enemy.stats {
if stat.kind == StatKind::IS_INVINCIBLE, continue outer_loop
}
if enemy.health <= 0 {
enemies.remove(idx--)
}
}