-
Notifications
You must be signed in to change notification settings - Fork 1
/
slask.ps1
51 lines (43 loc) · 1.1 KB
/
slask.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#switch parameter
cls
function MyAwesomeFunction1 {
[CMDLetBinding()]
param
(
[string] $foo,
[string] $bar,
[switch] $someVariable
)
Write-Host "someVariable = $someVariable" + $someVariable.GetType()
if ($someVariable) {
Write-Host $foo
}
else {
Write-Host $bar
}
}
#boolean parameter
function MyAwesomeFunction2 {
[CMDLetBinding()]
param
(
[string] $foo,
[string] $bar,
[bool] $someVariable
)
Write-Host "someVariable = $someVariable" + $someVariable.GetType()
if ($someVariable) {
Write-Host $foo
}
else {
Write-Host $bar
}
}
MyAwesomeFunction1 -foo "foo" -bar "bar" -someVariable:$true
MyAwesomeFunction1 -foo "foo" -bar "bar" -someVariable:$false
MyAwesomeFunction1 -foo "foo" -bar "bar" -someVariable
MyAwesomeFunction1 -foo "foo" -bar "bar"
MyAwesomeFunction2 -foo "foo" -bar "bar" -someVariable $true
MyAwesomeFunction2 -foo "foo" -bar "bar" -someVariable $false
MyAwesomeFunction2 -foo "foo" -bar "bar" -someVariable
MyAwesomeFunction2 -foo "foo" -bar "bar"