Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /