PowerShell - Control Flow
You need to iterate numbers 1 to 10 in PowerShell, skipping odd numbers and stopping the loop once the number exceeds 6. Which script correctly uses
break and continue?break and continue?continue when number modulo 2 is not zero ($num % 2 -ne 0).break when $num -gt 6.foreach ($num in 1..10) {
if ($num % 2 -ne 0) { continue }
if ($num -gt 6) { break }
Write-Output $num
} correctly implements these conditions.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions