Dotdown™ · inputs

Inputs and constants

What the customer fills in, what you decide in advance, and how to group them.

.input

A number the customer types. Name, a colon, then the label they see.

.input price: Price per unit (RM) positive
.input qty: Quantity
.r1 Subtotal (RM): price × qty
  • Add positive at the end to refuse negative numbers.
  • It is optional. A variable used in a step is found anyway, but then it has no label of its own.
  • Names start with a letter (any script) or an underscore, then letters, digits and underscores. r1, r2 … are taken by step results.
  • Inputs can share a line: .input width: Width (cm) .input height: Height (cm).

.list

A variable that takes a list of numbers separated by commas (70, 85, 90), for the list functions.

.list scores: Test scores
.r1 Average: mean(scores)
.r2 Marks: count(scores)
  • A list goes inside a list function on its own: mean(scores), not mean(scores + 1).
  • See the list functions.

.constant

Fixed numbers grouped under a name, used in a step as name.key. The customer is never asked for them.

.constant rice { kcal: 130, protein: 2.7 }
.input grams: Grams of rice
.r1 Calories: rice.kcal × grams ÷ 100
  • Use one for a price list, a tax rate, a table of nutrition values, anything you set once.
  • Several constants can share a line, and a constant can run over several lines until its closing }.

.module

A find-and-pick list over constants, like a menu. The customer searches the items, adds rows with a quantity, and a step uses the totals as name.key.

.constant rice { serving: 150, kcal: 130 }
.constant roti { serving: 95, kcal: 317 }
.module meal: Your meal { items: rice, roti; by: serving; per: 100; sum: kcal }
.r1 Energy (kcal): meal.kcal
PartDoes
items:The constants to pick from.
sum:The keys to total. Each one is a result: meal.kcal.
by:Optional. A key to multiply by, like a serving weight. List several and each row gets a size menu offering the ones that item has.
per:Optional. A number to divide by, like 100 when values are per 100 g.
  • Each row adds quantity × item.by × item.key ÷ per.
  • name.count (meal.count) is how many rows are picked.
  • Separate the parts with ; or with new lines.

Sizes

.constant rice { serving: 150, cup: 200, kcal: 130, protein: 2.7 }
.constant roti { serving: 95, kcal: 317, protein: 9 }
.module meal: Your meal {
items: rice, roti
by: serving, cup
per: 100
sum: kcal, protein
}

.sect

Starts a titled section. The inputs, modules and steps below it show under that title, stacked in order, until the next .sect.

.sect Pick your paper
.constant art { cost: 12 }
.constant kraft { cost: 8 }
.module paper: Paper { items: art, kraft; sum: cost }
.sect Your quote
.input copies: Copies positive
.r1 Total: copies × paper.cost
  • Without any .sect the calculator is one untitled section.
  • Step numbers keep counting across sections.
Open the builder