StoicBuilder
Later missionMission 4: Twenty dollars on the dotYou can practise it now. It counts once you reach mission 4, after “The total says $011.504.002.99”.Back to HQ
Exit lesson
ConditionalsProLesson 5 of 45, about 4 min
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
0 XP

The app: QuickBite

QuickBiteYour order
Bangkok Garden, Thai25–35 min
Pad thaiRice noodles, tamarind, peanuts. $11.50 each
1 
Mango sticky riceSweet coconut rice, fresh mango. $8.50 each
0 

Free delivery on orders of $20 or more

1× Pad thai$11.50
Delivery$2.99
Total$14.49

Deliver to 12 Elm Street

The data behind it

checkout.js the ruleselse branch ran
1let delivery;2if (subtotal >= 20) {3 delivery = 0;4} else {5 delivery = 2.99;6}7 8let discount = 0;9if (isMember && subtotal >= 20) {10 discount = 3;11}
Watch values and answers, live
subtotal:
subtotal >= 20:
delivery:
isMember:
isMember && subtotal >= 20:
discount:

The MagisterThis order comes to $11.50, and QuickBite delivers free from $20. The code decides with if: it asks a question that comes out true or false, then runs one branch or the other. Tap the answer to subtotal >= 20.

Step 1 of 6Tap the answer to the condition
  • Under Watch, tap the answer to subtotal >= 20

You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.