Answers for "foreach skip to next iteration"

0

foreach skip current iteration

// You can skip the current iteration using "continue"
// Example: Skip the current iteration if $number is 3;
$numbers = [1, 2, 3, 4, 5];

foreach($numbers as $number) {
	if($number == 3) {
    	continue;
    }
	echo $number . " + ";
}
// output: 1 + 2 + 4 + 5 +
Posted by: Guest on January-14-2021
0

foreach skip to next java

for(String str : strArr) {
	continue; //Skips current iteration and moves onto the following 
}
Posted by: Guest on November-08-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language