C in 100 Seconds: Switch — case, break, default | Episode 6
1views
002:24
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Switch in 100 seconds. Match a value against cases. Break stops fall-through. Default catches everything else.
Day is 3. Switch checks case 1, case 2, case 3 — match. Print Wednesday. Break exits. Without break, execution falls through to every case
below. Default is the else of switch — it catches anything that didn't match.
Cleaner than chaining five else-ifs when you have exact values to check.
Student code: https://github.com/GoCelesteAI/c-in-100-seconds/tree/main/episode06
What You'll Learn:
• switch — match a value against cases
• case — each possible match
• break — exit the switch after a match
• default — catch everything else
• Fall-through behavior without break
Next: Episode 7 — While Loops
#c #programming #100seconds #learnc #switch #case #break #default #tutorial
Tags
c switch, switch case c, break c, default c, fall through c, c tutorial 2026, c beginner, 100 seconds, learn c, coding tutorial
Tags
c switchswitch case cbreak cdefault cfall through cc tutorial 2026c beginner100 secondslearn ccoding tutorial