Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

To be useful, persistent variables must be mutated. Persistents can only be mutated in the postlude.

The following statements mutate persistent variables:

  • clear <pvar>. This deletes the persistent variable <pvar>
  • <pvar> := <expr>. This assigns the value of <expr> to <pvar>.

If the persistent variable is bound to a complex data structure (i.e. maps and arrays), <pvar> can contain a hash path referencing part of the structure. 

Example

fired {
  ent:a := 1;
  app:b{"foo"} := 1 + my_var.defaultsTo(0);
  app:b{["flip", "flop"]} := "this is a string";
  ent:c := null
  clear ent:a
}
  • No labels