How to skip some of the array elements in C++?
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Consider the program: In this program each third element of the array is skipping.
Output
We are using % (modulus operator) to check every 3rd iteration. If it is, the continue will skip everything down in loop's scope and continue executing the next iteration. For all other elements it will print them.
Small trick, but might come handy in future. If you find this amazing, leave comments below.
need an explanation for this answer? contact us directly to get an explanation for this answer