🎉 Congratulations, you got a super discount!⚡️ 50% OFF COUPON

Continue

In this section, we will guide you on how to use the Continue block.

Use Cases

The continue statement in JavaScript is primarily used in loop structures. Its purpose is to skip the remaining code of the current iteration and proceed directly to the next one. In other words, it prematurely ends the current loop iteration but does not stop the entire loop.

In the following example, when the value is equal to b, the logging will be skipped, and the next iteration will begin.

const items = ['a', 'b', 'c']

for (let [index, value] of Object.entries(items)) {
  if (value === 'b') {
    continue
  }
  console.log(index, value)
}

This is a handy feature, and Tapicker supports it through the Continue block.

continue

Difference from Break

You might think that Continue and Break are similar, but please don’t confuse them. Here are their key differences:

  • The break statement immediately terminates the entire loop.
  • The continue statement only skips the rest of the current iteration and continues with the next one.

Skipping a Loop

The Continue block is often used in combination with the Condition block. In this example, when the loop's value is equal to b, the Print Log block is skipped, and the next iteration begins.

continue-loop

After executing the above example, the log will be printed as follows:

a
// skip
c