Robot ID Card Controls
Compound Conditions
Watch how these expressions evaluate as you change the controls:
isOnline && energyLevel > 20 isOnline && energyLevel > 20
Result: true
Both conditions checked
!isOnline || energyLevel < 25 !isOnline || energyLevel < 25
Result: false
Both conditions checked
isOnline && !isCharging && energyLevel > 50 isOnline && !isCharging && energyLevel > 50
Result: true
All conditions checked
energyLevel > 0 || isCharging energyLevel > 0 || isCharging
Result: true
Short-circuited at first condition!
Default Value Pattern
See how || returns the first truthy value:
Try: "hello", 42, 0, null, undefined, "", []
nickname || "HyBit A. ProtoBot" displayName: "HyBit A. ProtoBot"
nickname is empty (falsy), so it returns the second value