Skip to content

Commit 440d061

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Template.DoLoop.py ( Fixes #929 )
1 parent a4e2280 commit 440d061

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

docs/Template.DoLoop.py.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Template.DoLoop.py
2+
------------------
3+
4+
### Synopsis
5+
Template for a Python `do` Loop
6+
7+
---
8+
9+
### Description
10+
11+
Template for a `do` loop in Python.
12+
13+
---
14+
15+
### Examples
16+
> EXAMPLE 1
17+
18+
```PowerShell
19+
Template.DoLoop.py -Condition "False" -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` 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, and,
71+
72+
---
73+
74+
### Syntax
75+
```PowerShell
76+
Template.DoLoop.py [[-Condition] <String>] [[-InitialCondition] <String>] [[-Body] <String>] [[-BodyIndent] <Int32>] [[-Indent] <Int32>] [<CommonParameters>]
77+
```

0 commit comments

Comments
 (0)