Skip to content

Commit 01cc9fe

Browse files
Cydrozandyleejordan
authored andcommitted
Define $i before use
1 parent 2e8fdc9 commit 01cc9fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

snippets/PowerShell.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@
166166
"description": "Insert a foreach loop with Write-Progress initialized",
167167
"body": [
168168
"\\$total = \\$${1:array}.count",
169+
"\\$i = 1",
169170
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
170171
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
171-
"\\$i = 1",
172172
"foreach ($${2:item} in $${1:array}) {",
173173
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
174174
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",

0 commit comments

Comments
 (0)