Skip to content

Commit

Permalink
Define $i before use
Browse files Browse the repository at this point in the history
  • Loading branch information
Cydroz authored and andyleejordan committed Jan 10, 2025
1 parent 2e8fdc9 commit 01cc9fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion snippets/PowerShell.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@
"description": "Insert a foreach loop with Write-Progress initialized",
"body": [
"\\$total = \\$${1:array}.count",
"\\$i = 1",
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
"\\$i = 1",
"foreach ($${2:item} in $${1:array}) {",
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
Expand Down

0 comments on commit 01cc9fe

Please sign in to comment.