874 B
874 B
| id | name | category | kind | tokens | sig | tip | order |
|---|---|---|---|---|---|---|---|
| kw-continue | continue | control | keyword | continue | continue | Skip to the next iteration of the loop. | 10 |
continue abandons the rest of the current loop pass and jumps straight to the next one — the next condition check in a while, or the next index in a for. Use it to skip elements that do not apply without nesting the rest of the body inside an if: filter out empty slots, ignore inactive entities, or step over even numbers. Like break, it acts on the innermost loop only.
program SumOdds {
state SumOddsState {
total: int = 0
}
handler Add(sum_odds_st: mut SumOddsState) phase Update {
for i in 0 .. 10 {
if i % 2 == 0 { continue } # skip even numbers
sum_odds_st.total = sum_odds_st.total + i
}
}
}