⏭️ continue Statement in C

⏭️ continue Statement in C

🔍 Short Explanation:
The continue statement skips the current iteration of a loop and moves directly to the next iteration, bypassing the remaining code inside the loop for that cycle.


✅ Syntax

continue;
  

📋 Example: Continue in a for Loop

#include <stdio.h>

int main() {
    for (int i = 1; i <= 5; i++) {
        if (i == 3) {
            continue;  // skip iteration when i is 3
        }
        printf("%d\\n", i);
    }
    return 0;
}
  

🧠 Output: 1 2 4 5

💡 Common Use Cases

  • Skipping specific values or conditions in loops
  • Filtering unwanted data during iteration
  • Improving readability instead of nested if-else

⚠️ Tips & Best Practices

  • Use carefully to avoid infinite loops
  • Do not confuse with break, which exits the loop entirely
  • Helps in cleaner and more readable loops

📌 Summary

The continue statement is useful to skip over parts of a loop’s body under certain conditions, continuing the loop with the next iteration.


Keywords: continue statement in c, c programming continue example, loop control statements c, skip iteration in c loop, continue usage in c Tags: c programming, continue statement, loop control, beginner programming, c language tutorial, iteration control

একটি মন্তব্য পোস্ট করুন