Skip to content

17 Continue ​

continue skips the rest of one iteration and proceeds to the next.

norm
main() {
  List<String> tasks = ["read", "skip", "change"]
  for task : tasks {
    if task == "skip" {
      continue
    }
    printLine(task)
  }
  printLine("finished")
}

Expected output:

text
read
change
finished

Only the item skip is omitted. Later elements still run, which makes continue different from the preceding break example.

Try it: Change the skipped value to read and predict the lines.

Precise rules: Reference.

Norm 0.25