Introduction
Imagine you want to decide what to wear based on the weather. You need a way to make choices depending on different situations. Conditional logic helps computers make decisions like this by checking if something is true or false.
Imagine you are deciding what to wear before going outside. You first check if it is raining; if yes, you take an umbrella. If not, you check if it is sunny; if yes, you wear sunglasses. Otherwise, you just wear your regular clothes.
┌───────────────┐
│ Start │
└──────┬────────┘
│
▼
┌───────────────┐
│ Check condition│
│ (Is it raining?)│
└──────┬────────┘
│Yes
▼
┌───────────────┐
│ Take umbrella │
└──────┬────────┘
│
▼
┌───────┐
│ End │
└───────┘
│No
▼
┌───────────────┐
│ Check else if │
│ (Is it sunny?)│
└──────┬────────┘
│Yes
▼
┌───────────────┐
│ Wear sunglasses│
└──────┬────────┘
│
▼
┌───────┐
│ End │
└───────┘
│No
▼
┌───────────────┐
│ Wear regular │
│ clothes │
└──────┬────────┘
│
▼
┌───────┐
│ End │
└───────┘