Snippets/Condition/switch.snippets.ps1xml

<?xml version='1.0' encoding='utf-8' ?>
    <Snippets xmlns='http://schemas.microsoft.com/PowerShell/Snippets'>
        <Snippet Version='1.0.0'>
            <Header>
                <Title>switch</Title>
                <Description>inserts a switch condition that can check for multiple conditions based on the value submitted to switch.</Description>
                <Shortcut>swi</Shortcut>
                <Keywords>ScriptBlock,Editor</Keywords>
                <Author>Tobias</Author>
                <DifficultyLevel>2</DifficultyLevel>
                <Example>False</Example>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                </SnippetTypes>
                <Requirements>
                    <MinimumPowerShellVersion>1</MinimumPowerShellVersion>
                    <RequiredModules></RequiredModules>
                    <AdminPrivileges>False</AdminPrivileges>
                    <ProcessorArchitecture>x86,x64</ProcessorArchitecture>
                </Requirements>
            </Header>
            <Declarations>
                <Literal>
                   <ID><![CDATA[9;1;1]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[variable to check against]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[18;1;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[value to check]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[52;5;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[code to execute]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[79;1;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[value to check]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[94;5;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[code to execute]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[112;8;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[condition to check]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[126;16;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[code to execute]]></ToolTipStatusbar>
                </Literal>
                <Literal>
                   <ID><![CDATA[164;15;0]]></ID>
                   <Default></Default>
                   <ToolTip><![CDATA[]]></ToolTip>
                   <ToolTipStatusbar><![CDATA[code to execute when nothing else matched]]></ToolTipStatusbar>
                </Literal>
            </Declarations>
 
 
            <Code>
                <Script Language='PowerShell' PowerShellCaretOffset='8'>
                    <![CDATA[switch ($a)
{
  1 {
                 'one'
               }
  2 { 'two'; break}
  {$_ -gt 1} { 'greater than 1'}
 
  default { 'anything else'}
}]]>
                </Script>
            </Code>
 
    </Snippet>
</Snippets>