Link to home
Start Free TrialLog in
Avatar of sirbounty
sirbountyFlag for United States of America

asked on

Powershell logic

Need to make sure I'm thinking this through.

If a criteria is true, then I need to perform another test, otherwise perform the default test.
Thus, I need to drop out of an if statement, but continue my foreach....is break the statement I need for this?

foreach ($cog in $widgests) {
if ($something -eq $true) {
  if ($something else -eq $true) {
    #do something
  } else {
    #This is bad - don't even try the additional tests
    break; #??
  }
} else {
  if ($test -eq $true) {write-host 'All is right with the world'} else {write-host 'Who moved my cheese?'}
}
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Joe Klimis
Joe Klimis
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial