Skip to content

Comments, labels and line references

Annotate Zlv sheets with # and // comments, name values as labels, and reuse earlier answers with prev, ans and line references such as line3.

A good sheet explains itself. Zlv lets you mix notes with numbers and point back to earlier results without retyping them.

Comments

A line that starts with # or // is a comment and is never calculated. Use # lines as headings to split a sheet into sections.

You can also put a comment after a calculation on the same line. Everything after # or // is ignored.

Live example
Edit the lines and press Run. Evaluated in your browser.

Evaluating…

Labels are variable names

To label a number, give it a name. Both = and : work, so rent: 1200 reads like a label and still defines rent for later lines.

Live example
Edit the lines and press Run. Evaluated in your browser.

Evaluating…

A bare word in front of a number, such as Coffee 4.50, is read as an unknown variable and shows an error. Put the word in a comment or make it a name: coffee = 4.50.

In the desktop app, words written after a number are also allowed as descriptive tags, which makes quantities read naturally:

Desktop example
Uses the native Rust engine: copy it into Zlv Desktop to see results.

Results appear next to each line in Zlv Desktop. Download it free.

The previous result: prev and ans

prev and ans both mean the result of the closest line above that has a value. Comments and blank lines in between are skipped.

Live example
Edit the lines and press Run. Evaluated in your browser.

Evaluating…

The desktop engine also accepts last as another name for the previous result.

Line references

In the desktop app you can point at any earlier line by its line number with line followed by the number. Line numbers are the ones shown in the editor gutter, counting from 1.

Desktop example
Uses the native Rust engine: copy it into Zlv Desktop to see results.

Results appear next to each line in Zlv Desktop. Download it free.

The referenced line must have a value. Pointing at a comment, a blank line or a line further down shows an error.

Errors stay on their line

If Zlv cannot read a line, it shows an error message next to that line only. Lines that do not depend on it keep calculating. Hover over or click the error in the desktop app to see the full message.

All guides