fix(curriculum): clarify elif evaluation order (#65563)

This commit is contained in:
Jeevankumar S
2026-01-30 23:57:39 +05:30
committed by GitHub
parent 0035e17784
commit 95aa78408f
3 changed files with 5 additions and 5 deletions

View File

@@ -111,10 +111,10 @@ There might be situations in which you want to account for multiple conditions.
Here's the syntax:
```python
if condition:
pass # Code to execute if condition is True
if condition1:
pass # Code to execute if condition1 is True
elif condition2:
pass # Code to execute if condition2 is True
pass # Code to execute if condition1 is False and condition2 is True
else:
pass # Code to execute if all conditions are False
```

View File

@@ -711,7 +711,7 @@ if age >= 18:
print('You are an adult') # You are an adult
```
- **`elif` Statement**: These are conditions that come after an `if` statement. If the `elif` condition evaluates to `True`, then that block of code will run.
- **`elif` Statement**: These are conditions that come after an `if` statement. An `elif` block runs only if all previous conditions evaluate to `False` and its own condition evaluates to `True`.
```py
age = 16

View File

@@ -13,7 +13,7 @@ The `if...elif...else` statement is used to check multiple conditions in order.
if condition1:
# Code to execute if condition1 is True
elif condition2:
# Code to execute if condition2 is True
# Code to execute if condition1 is False and condition2 is True
else:
# Code to execute if all conditions are False
```