StoicBuilder

HandbookI the LudusConditionals

Ithe Ludus, Read code

Conditionals

1 min readUpdated 28 November

In plain words

A conditional is an if/else check that lets your code do one thing when something is true and another thing when it isn't.

Where you see it

QuickBite gives free delivery on orders of 30 or more and charges a fee below that. An if somewhere decides which one each customer gets, and an order of exactly 30 depends on whether it says > or >=.

lib/pricing.tsserver
function deliveryFee(subtotal: number) { if (subtotal >= 30) { return 0; } else if (subtotal >= 15) { return 2; } return 4;}
Checks run top to bottom, the first true one wins, and the last line catches everything else.

What goes wrong

  1. Checks in the wrong order

    If subtotal >= 15 comes first, a 40 order matches it and never reaches the free-delivery check. The first true branch wins and the rest are skipped.

  2. The boundary is off by one

    > 30 and >= 30 only differ when the order is exactly 30. Match the code to the wording on the page: "from 30" means >=.

  3. No else for the leftover case

    When none of the branches match, nothing happens. No error, no message, a button that does nothing when pressed.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Write out the delivery fee rules as a plain-English table: each input range and what the customer pays. Include the exact boundary values, like an order of exactly 30, and what happens when none of the conditions match.

Quick check

Sign in to earn +10 XP for it

QuickBite promises free delivery from 30. A customer with a 30.00 order is charged a fee. Which check is wrong?

Got a prompt that touches conditionals?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.