Example 2:

 The following example uses a do-while loop with a continue statement which displays the values from 10 to 20, excluding 15 and 18.

PS C:\> $a=10  

PS C:\> do  

>> {  

>> if (($a -eq 15) ?or ($a -eq 18))  

>> {  

>> $a++  

>> continue  

>> }  

>> echo $a  

>> $a++   

>> } while($a -le 20)

    Output:10 11 12 13 14 16 17 19 20


    Posted

    in

    by

    Tags:

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *