Start here · In your browser

Challenge: can I afford it?

A code cell with the real Luau runner grades it. No Studio needed.

Open

Level 1, Apprentice

Challenge

Write a function that says whether a player can buy something. The cell below runs a hidden test when you press Run.

Start from
The code cell below the challenge, which runs a hidden test when you press Run.
Check it here
Run the code cell; the challenge completes when it passes. No Studio needed.

Done means

  • canAfford(40, 40) is true
  • canAfford(39, 40) is false
  • canAfford(0, 0) is true
  • It returns a boolean, not nil
Luau
Ctrl Enter runs the cell. Checked by tests