Nested Switch

by May 1, 2011

Hi,

is it possible to use nested SWITCH – Statements in Powershell?

PS returns a syntax error on the following code

$b=0

$c=1

$a=switch ($b) {

                          0 {"b=0"}

                          1 {switch (c$) 1 {"b=1 and c=1"} default {"b=1 but c !=1"}}

                          default {"b is not 0 as not 1"}

                          }

I haven't found anything forbidding to use nested switches but it looks like they are forbidden. Is it so?

Alexander