break/continue can be used to break out of loops or switch statements.  continue can be used to force the loop to restart with the next value.  


psloop {
 echo ${server.name};

 if ($myattribute = "nomore") {

   // Stop when we find an Endpoint with myattribute = "nomore"

   echo "Breaking";

   break;        // break out of loop

 }
}

echo "end of loop";


In this example, DeployHub will iterate through the current Endpoint set, looking at the value of myattribute for each Endpoint. When it finds an Endpoint with this attribute set to the value of nomore it will break out of the loop.


Here is an example of how to use continue:


for (i=1;$i<=10;i=$i+1) {

if ($i = 5) {

continue;

}

echo $i;

}


The output from this code will be:

1

2

3

4

6

7

8

9

10


This is because the fifth time through the loop, i will be 5. The condition will match and execute "continue" which will restart the loop with the next value (6).