Ravi Sir's Cards › AWS
if/elif vs case
This comparison card contrasts if/elif and case. if/elif is described as any tests, any mix. case: One value, many patterns.
Read card text
What this card says
Choose
if/elif
Any tests, any mix.
case
One value, many patterns.
Key points
Long chains get messy.
Clean menus.
Example
if [[ -z $1 ]]; then
Use when
Ranges, files, numbers.
start/stop/status.