Anda di halaman 1dari 2

about_Switch

switch IF

If "
"If
switch ({})

switch If
switch

PS> $a = 3
PS> switch ($a) {
1 {"It is one."}
2 {"It is two."}
3 {"It is three."}
4 {"It is four."}
}

It is three.

PS> $day = "day5"


PS> switch ($day){
day1 {"Monday"; break}
day2 {"Tuesday"; break}
day3 {"Wednesday"; break}
day4 {"Thursday"; break}
day5 {"Friday"; break}
day6 {"Saturday"; break}
day7 {"Sunday"; break}
day5 {"Too many days"; break}
}

Friday

day5 break switch

break day5

switch 0

switch

switch [-regex|-wildcard|-exact][-casesensitive] ( pipeline )


switch [-regex|-wildcard|-exact][-casesensitive] -file filename


{
"string"|number|variable|{ expression } { statementlist }
default { statementlist }
}

Switch ""
"pipeline" 0

Switch default
default ParseException

Switch

Regex
Wildcard Exact

Wildcard Regex
Exact

Exact Wildcard
Regex

CaseSensitive

File File
switch

RegexWildcard Exact Switch

Break Switch

Continue
Switch

"{ expression }""$_"


"True"

Switch "Default"
(}) break

Break
Continue

about_Break
about_Continue
about_If
about_Script_Blocks

Anda mungkin juga menyukai