Skip to content

Commit 65a1ca1

Browse files
author
Kapil Borle
authored
Merge pull request #715 from TravisEz13/patch-1
Moved header out of code block
2 parents 8f933fa + 7c5016d commit 65a1ca1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

RuleDocumentation/AvoidUninitializedVariable.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
#AvoidUninitializedVariable
1+
#AvoidUninitializedVariable
2+
23
**Severity Level: Warning**
34

45
##Description
6+
57
A variable is a unit of memory in which values are stored. Windows PowerShell controls access to variables, functions, aliases, and drives through a mechanism known as scoping.
68

79
All non-global variables must be initialized, otherwise potential bugs could be introduced.
810

911
##How to Fix
12+
1013
Initialize non-global variables.
1114

1215
##Example
16+
1317
###Wrong:
18+
1419
``` PowerShell
1520
function NotGlobal {
1621
$localVars = "Localization?"
1722
$uninitialized
1823
Write-Output $uninitialized
1924
}
25+
```
2026

2127
###Correct:
28+
2229
``` PowerShell
2330
function NotGlobal {
2431
$localVars = "Localization?"

0 commit comments

Comments
 (0)