Arithmetic operators

Arithmetic operators perform operations on numbers and text. You can use them in variable definitions, conditions, and actions.

Table 1. Arithmetic operators
Operator Description Example

- <number>

Makes a number negative.

if
   the credit of 'the customer' is less than -100
then
   print "The customer is overdrawn";

<number> + <number>

Adds a number to another number.

if
   there is at least one purchase event
then
   set the flow rate of 'the customer' to the flow rate of 'the customer' + 100;

<number> - <number>

Subtracts a number from another number.

if
   the number of purchase events - the number of purchase returned events is more than 0
then ...

<number> / <number>

Divides a number by another number.

If both numbers are integers, the result is also an integer (the result of the division without the remainder.)

definitions
   set 'purchase event count' to the number of purchase events;
   set 'total amount' to the total amount of all purchase events;
if 
   'purchase event count' is more than 0
then
   set the average amount of 'the customer' to 'total amount' / 'purchase event count';

<number> * <number>

Multiplies a number by another number.

when a purchase event occurs
definitions
   set 'sales tax' to 0.2;
if the amount of this
purchase event * 'sales tax' is
more than 100
then...

<text> + <text>

Concatenates two strings.

definitions
   set 'first name' to the first name of 'the customer';
   set 'last name' to the last name of 'the customer';
then
    print "Full name" + 'first name' + " " + 'last name';

<number> + <text>

Concatenates a number and a string. The result is treated as a string.

when a purchase event occurs, called 'the purchase'
then
   print "You spent " + the amount of 'the purchase' + " Euros";

<text> + <number>

Concatenates a string and a number. The result is treated as a string.

when a purchase event occurs, called 'the purchase'
then
   print "You spent $“ + the amount of 'the purchase';