Flags, counters, and literal value persistent variables can be used inside prelude expressions like any other variable.
For historical reasons, if the persistent variable does not exist before it is used, the default value is 0.
This means that the isnull() operator, for example, is never true for an entity variable.
The following declaration would add 3 to the value stored in the entity counter
ent:fizz, storing the result in
KRL includes special built-in functions for accessing individual places in a trail:
history. This takes an expression and a persistent variable as arguments. If the expression evaluates to n, then the
historyfunction will return the nth place on the trail. The most recent place is at history location 0. If n is larger than the length of the trail, the history function returns the empty string.
current. This takes a persistent variable as its argument. The
currentfunction performs the same operation as the
historyfunction with a location of 0. That is, it returns the most recent place on the trail.