Course / Module 1
Module 1 of 7

Values and names

Numbers, text, and true/false, and naming values so a program reads like a sentence.

values variables assignment renaming

Programs work with values: numbers like 40, text like "priority", and the two truth values true and false.

A value is more useful when it has a name. In Devlish you give a value a name with equals. Once a value has a name, you can use that name anywhere later in the program, and you can build new values out of old ones.

Giving something a clear name is not decoration. It is what lets a program read like a sentence, so the person reviewing it can follow the logic without translating code in their head. In the program below, grand total is just another name for a value we already computed, added so the final line reads plainly.

Try it in your browser

Run it. Each line names a value or builds one from values already named above it.

Takeaway

Names turn a pile of values into a readable program. Change the numbers and re-run: the logic stays the same, only the values move.