# Decisions

Decisions: If This, Then That: \`if\`, \`elseif\` and \`else\`, Many Choices: \`switch\`.

Updated: November 10, 2026

1. [If This, Then That: \`if\`, \`elseif\` and \`else\`](https://www.ask-codey.com/lessons/powershell-if-statements) (Apprentice): if runs a block of commands only when its test is True, elseif adds another test, else catches everything left, -and, -or and -not join tests together, and exit stops a script early, so a backup copies only when something changed and explains itself when it can't.
2. [Many Choices: \`switch\`](https://www.ask-codey.com/lessons/powershell-switch) (Apprentice): switch compares one value with a list of choices and runs the block of each one that matches, with default for anything else; -Wildcard and -Regex match patterns instead of exact text, and a switch on a Read-Host answer makes a simple menu.

Source: https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-decisions
