I have this script:
1..10|%{
$_
if(($_ % 3) -eq 0)
{
"wow"
break
}
}
"hello"
I expect from 1 to 10, when meeting 3 it prints"wow", and finally "hello" But actual output is:
1
2
3
kkk
So "break" seems to break not the %{} loop in pipeline, but broke the whole program? How can I break in the loop, while keep executing later statements?
Thank you.