Syntax Guide
Percentages, dollar shorthand, units, and special syntax.
Basics
| Syntax | Example | Notes |
|---|---|---|
= | x = 42 | Assign a variable |
// | // this is a comment | Comment line |
+ - * / | 2 + 3 * 4 | Standard arithmetic (order of operations applies) |
^ | 2^10 | Exponentiation |
() | (2 + 3) * 4 | Grouping |
Percentages
Write percentages naturally:
200 + 15% // = 230 (adds 15% of 200)
200 * 15% // = 30 (15% of 200)
tax_rate = 8.5% // = 0.085 Dollar & unit shorthand
$100 // formatted as dollars
$2.5m // 2,500,000
450k // 450,000 Sliders
Add @slider(min, max) to make any variable interactive:
nights = 5 // @slider(1, 14) Coming soon
More content on date math, unit conversions, and conditional expressions.