Cantoris (7) [Avatar] Offline
#1
Section 5.6 covers the Break command but there's no mention of the Continue command.
I use Continue far more than Break.

For example when going through a collection of Computers using foreach, I might have a Test-Connection that uses Continue if the PC is offline to move onto the next computer. Then there may be some other sorts of test one after the other checking on various conditions which if they are not met each trigger a Continue. I find this makes a far more readable script than having a load of nested If constructs.

I know it does get strange when used within the pipeline though.
193774 (3) [Avatar] Offline
#2
I was also surprised that there was no mention of using continue to short circuit loops instead of using lots of if statements.