|
| 1 | +Template.UntilLoop.py |
| 2 | +--------------------- |
| 3 | + |
| 4 | +### Synopsis |
| 5 | +Template for a Python `until` Loop |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +### Description |
| 10 | + |
| 11 | +Template for a `until` loop in Python. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +### Examples |
| 16 | +> EXAMPLE 1 |
| 17 | +
|
| 18 | +```PowerShell |
| 19 | +Template.UntilLoop.py -Condition "True" -Body "print('This happens once')" |
| 20 | +``` |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +### Parameters |
| 25 | +#### **Condition** |
| 26 | +The Loop's Condition. |
| 27 | +This determines if the loop should continue running. |
| 28 | +This defaults to 0 > 1, so that the loop only occurs once |
| 29 | + |
| 30 | +|Type |Required|Position|PipelineInput | |
| 31 | +|----------|--------|--------|---------------------| |
| 32 | +|`[String]`|false |1 |true (ByPropertyName)| |
| 33 | + |
| 34 | +#### **InitialCondition** |
| 35 | +The Loop's Initial Condition. |
| 36 | +Since Python does not have a `do` loop, this needs to be any truthy condition for the loop to run. |
| 37 | + |
| 38 | +|Type |Required|Position|PipelineInput | |
| 39 | +|----------|--------|--------|---------------------| |
| 40 | +|`[String]`|false |2 |true (ByPropertyName)| |
| 41 | + |
| 42 | +#### **Body** |
| 43 | +The body of the loop |
| 44 | + |
| 45 | +|Type |Required|Position|PipelineInput | |
| 46 | +|----------|--------|--------|---------------------| |
| 47 | +|`[String]`|false |3 |true (ByPropertyName)| |
| 48 | + |
| 49 | +#### **BodyIndent** |
| 50 | +The number of spaces to indent the body. |
| 51 | +By default, two. |
| 52 | + |
| 53 | +|Type |Required|Position|PipelineInput | |
| 54 | +|---------|--------|--------|---------------------| |
| 55 | +|`[Int32]`|false |4 |true (ByPropertyName)| |
| 56 | + |
| 57 | +#### **Indent** |
| 58 | +The number of spaces to indent all code. |
| 59 | +By default, zero |
| 60 | + |
| 61 | +|Type |Required|Position|PipelineInput | |
| 62 | +|---------|--------|--------|---------------------| |
| 63 | +|`[Int32]`|false |5 |true (ByPropertyName)| |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +### Notes |
| 68 | +There is not a proper `do` or `until` loop in Python, so we have to be a little creative. |
| 69 | + |
| 70 | +This will produce a while loop where the `-InitialCondition` should always be true, |
| 71 | +and the `-Condition` will be checked at the end of each iteration. |
| 72 | + |
| 73 | +If the `Condition` is true, then the loop will break. |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +### Syntax |
| 78 | +```PowerShell |
| 79 | +Template.UntilLoop.py [[-Condition] <String>] [[-InitialCondition] <String>] [[-Body] <String>] [[-BodyIndent] <Int32>] [[-Indent] <Int32>] [<CommonParameters>] |
| 80 | +``` |
0 commit comments