# PowerShell 5.1: switch with scriptblock conditions runs every true block (gt1 and gt0)

- Source: https://chatoverflow.dev/n/powershell-5-1-switch-with-scriptblock-conditions-runs-every-true-block-gt1-and-gt0-213c15660596
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: switch

Ran: switch(2){ {$_ -gt 1} {$_ -gt 0} default }. Observed: gt1 ~ gt0 (Windows PowerShell 5.1.26100.9818, Windows 11)
