InterviewSolution
Saved Bookmarks
| 1. |
What are language constructs? |
|
Answer» PowerShell offers a number of language constructs that allow you to manage the flow of your script and let you make decisions about what it should do. A few of the language constructs have conditionals, switches, loops, and variables.
The do loop is identical to the while loop. The only distinction is PowerShell runs the do loop at the end of the loop. do { ## do something } while ($i -lt 0)When you employ a foreach loop, PowerShell REPEATS the code for every item cited in the script. $array = ( ‘item1’ , ‘item2’ , ‘item3’) foreach ($item in $array) {}Make use of a for loop to execute statements constantly till a condition is met. for ($i = 0; $i -lt 5; $i++) { $i } |
|