Skip to main content

References & Variables

A cool feature of hissab is that it can store results for any expression in a variable of any name, which can be referenced in any other expression.

Here 'myvar' is a variable name. There are rules around variable names.

  • Variable cannot start from a number or special character, except _ (underscore).
  • It must start from a letter.
  • It cannot contain any special character except _.

Variables can hold values with units as well as dates and times.

Variable names are case-sensitive.

Variable names cannot be a unit name or hissab keyword like 'time'.

Variable declaration must be at the beginning of an expression.

You can directly reference results from any previous lines without storing it in variables as well by using line (or just l) followed by the line number and no space in between.

You cannot only refer to lines above the current line.

You can refer to the previous line's result with the 'prev' keyword.

'prev' keyword also works if there are empty lines in between.

If you want to add results from all above lines, you can use the 'total' keyword. This only works if those results are addable.