Break command

13/10/2012 02:34

#break script, I needed it for validation

 

#break command
$i=100
if($i -gt 50)
{
   write-host "greater than 50"
   break
}
else
{
    if($i -lt 10)
    {
        write-host "Less than 10"
        break
    }
   write-host "less than 50"
  
}
write-host "continued"

 

if $i = 1, output is: Less than 10

if $i = 20, output is: less than 50, continued

if $i = 100, output is: greater than 50