im trying to have a for loop which ends after 1 of 2 conditions is fullfilled.
I dont know what i am missing but with "-or" between these 2 conditions only one condition seems to be "working" i guess. Should the following for-loop not also quit after the value of $i is 3??
Here the code:
$test = "test"
$expected = "successful"
for($i = 0; ($i -lt 3) -or ($test -ne $expected); ($i++) -and (sleep 1)){
if($i -eq 5){
$test = $expected
}
$test
$i
}
and here is my output:
test 0 test 1 test 2 test 3 test 4 successful 5
-ormakes the loop continue as longer as either condition is satisfied, change the-orto an-and.