KRL declarations cannot cause side effects (i.e. they're not variable assignments). That doesn't mean KRL rule sets can't cause persistent changes that are available from one rule-set execution to another. KRL has persistent variables that can be used inside any expression in a rule set and can be changed in the postlude.
KRL has two types of persistent variables. (Persistent variables are currently limited to approximately 1,000,000 characters 1MB each.)
- Entity variables. These are used to record persistent data about individuals interacting with rules. Entity variables are identified by the namespace
ent. KRL programs keep each user's persistent entity variables separate. KRL programs are multi-tenanted automatically.
- Application variables. These are used to record persistent data about the application or rule set. Application variables are identified by the namespace
Entity , and application , and request variables share the same syntax and operations. They differ primarily in the scope of their definition. An analogy might help: Entity variables are similar to instance variables, and application variables are similar to class variables in object-oriented languages.
Persistent variables can be numbers, strings, arrays, or maps, and admit allow operations on those values.