Variables (coming soon)

Using a #+var block, you can declare a variables and assign values to them. Those variables could be then used as an interpolation expressions to substitue value inside a code, be used in loops and conditions statements or be passed as arguments to other blocks.

Variables declared in this way are considered top-level and defined in the scope of the package. If name of the variable starts from capital letter then this variable is exported from the package as part of its public API and could be referenced from other packages.

CoginitiScript hash following built-int data types:

Integer values, like 1, 2, 3, etc… up to max 64bit integer value.
Float values, like 0.75, 2.5, etc… up to max 64bit float value.
String values
Symbolic identifiers that evaluate to themselves. They provide very fast equality tests and recommend to be used as keys in Maps. Examples: :name:doc.
List of elements
Key / value pairs stored as a hash map.
  fields = ["name", "email", "postal_code"];
  num_users = 100;
  email_domain = "";
  maps = { :key "value" };

#+for f : fields separator "," do
  {{ f }}
  email LIKE "%@{{ email_domain }}"
  {{ num_users }}


Public / Private variables

Variables could be defined as public to be used outside of the given package in the same way as blocks, but having their name defined with capital letter.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request