Ready to begin
Choose Next step to follow the actual course records.
A OR B is true when at least one condition is true, including when both are true. A AND B requires both. An IF with an OR condition runs its body once when the condition is true; it does not run the body twice when both sides are true.

Trace the records, compare the methods and watch what changes. Back and Reset let you try again.
Ready
Choose Next step to follow the actual course records.
Start with Next step. Predict what changes before reading the explanation.
# Count students, not qualifying subject marks
Count = 0
for each score card X:
if X.Mathematics > 90 OR X.Physics > 90:
Count = Count + 1
# Different result: this counts successful subject tests
Count = 0
for each score card X:
if X.Mathematics > 90:
Count = Count + 1
if X.Physics > 90:
Count = Count + 1| A | B | A OR B | Increase with OR | Increase with two IFs |
|---|---|---|---|---|
| false | false | false | 0 | 0 |
| true | false | true | 1 | 1 |
| false | true | true | 1 | 1 |
| true | true | true | 1 | 2 |
In the actual scores, 6 students have Maths > 90 OR Physics > 90. Two independent increments produce 8 because Rahul and Deepika pass both tests. The extra 2 is the overlap. “Greater than 90” excludes exactly 90; do not silently change > to ≥.
You can count once using IF A … ELSE IF B … with the same increment, because B is then used only when A is false. But this structure is wrong if you want two separate subject counters that should both increase when both tests pass. Equivalent conditions alone do not make differently placed updates equivalent.
A student has Maths 97 and Physics 92. How much do the two programs add?
The OR program adds 1. The two independent IF program adds 2. This is Rahul’s actual pair of marks.
When can IF A OR B and two independent IFs with the same increment agree?
When no processed record can satisfy both A and B, or when the overlap happens to be empty in that dataset. Mutual exclusivity is the general structural reason.
If both conditions are false, does OR still count once?
No. The IF body is skipped, so both programs add zero.