Using ‘Continue’

by Oct 8, 2010

You will find that "Continue" is a special instruction that you can use in loops to skip the remainder of a loop.

This next loop returns only numbers between 1 and 20 that are divisible by 4:

For($x=$x -lt 20; $x++) {
If ($x % 4) { continue }
$x
}

Twitter This Tip!
ReTweet this Tip!