NikiVariable
The NikiProcessor calculates expressions and stores values.
Stored values, variables
A value can be stored into a variable. A variable is identified by its name. The name of a variable is like $Name_of_a_variable . The first character is a $, the second a character (A-Za-z) followed by a sequence of (A-Za-z0-9_) alphanumerical characters and the underscores, no blank or any other character.
Defining a variable
A variable can be defined as string or as evaluated formula:
- ---define $Name_of_a_variable = string
- ---define $Name_of_a_variable := formula
Pay attention: the formula is not surrounded by :( ...
.
The ---define starts on a new line just after a blank line. It is followed by a blank line. Several ---define's don't need to be separated by a blank line.
See NikiFormula.
Validity of variables
Variables are only valid in the current Niki. A variable has to be defined before it can be used.
Errors in ---define
If you use :( ... ): expressions in ---define :=, you will get an error message.
Errors in the formula of ---define := are treated as errors in formulas.
Using the value of a variable
The expression :$NameOfVariable: is substituted by its value. If the value of a variable is not defined, by an error sting like ERROR or ERROR('NameOfVariable').
Example
See NikiProcessorExample.
Listing definitions
For debugging purposes it may useful to list the ---define's in the Niki.
- ---define list on: enable listing, the following ---define will be listed
- ---define list result: enable listing and show the result of an evaluated formula in ---define ... := too
- ---define list off: disable listing, the following ---define will not be listed
The ---define list ... have to be surrounded by blank lines.
The ---define's will be listed like code. The results are appended like '-> result'.
Including Nikis
In some situations it is useful to include a Niki with common definitions.
See NikiInclude.