continue Keyword

The continue statement skips the rest of the current iteration of a loop and moves to the next check/iteration.
Use it in for, while, and do...while loops to ignore certain cases without exiting the loop.


Syntax

continue;

Examples

// ১) জোড় সংখ্যা স্কিপ
let যোগফল = 0;
প্রতি (let i = 1; i <= 10; i++) {
  যদি (i % 2 === 0) চলুন;  // জোড় বাদ
  যোগফল += i;
}
কনসোল.লগ("Odd sum =", যোগফল);

// ২) while এ ইনপুট ভ্যালিডেশন
let n = 0;
যতক্ষণ (n < 8) {
  n++;
  যদি (n < 3) চলুন;       // 1,2 স্কিপ
  ছাপাও("processing:", n);
}

// ৩) for...of — ফাঁকা স্ট্রিং স্কিপ
const শব্দসমূহ = ["Hi", "", "Bnlang", " ", "OK"];
প্রতি (const শব্দ এর শব্দসমূহ) {
  যদি (শব্দ.trim().length === 0) চলুন;
  দেখাও("=>", শব্দ);
}

Notes

  • continue does not exit the loop; it only skips to the next iteration.
  • In while/do...while, ensure state updates happen before continue to avoid infinite loops.
  • Prefer clear conditions; overusing continue can hurt readability. Use filtering (.filter) when appropriate.