ADD examples

Last Updated : Nov 03, 2016 |
Prolog information
The following table provides examples for using the ADD operator. The ADD operator adds operand1 and operand2.
Command
Result
set A = A ADD 456
A = 000123
123 + 456 = 579
This operation is useful for counters or loop control variables. The result does not retain the zeros.
set A = A ADD none
A = 9999999999
9999999999 + 0 = # + 0 = #
If an operand contains a value greater than 4294967295, the result is null (#).
set A = A ADD B
A = 000123
B = #
123 + # = #
The # character in a variable is seen as invalid (#).
set A = A ADD A
A = none (or null string)
0 + 0 = 0
none is interpreted as 0
set B = A ADD 456
Variable definitions:
  • A = 1234
  • B = collect type, length = 3, start = 2 (start is ignored)
1234 + 456 = 1690 = #
This is an overflow since the result was greater than three digits.
set B = A ADD 456
Variable definitions:
  • A = 1234
  • B = collect type, length = 5, start = 2 (start is ignored)
1234 + 456 = 1690
No leading zeros are included in the result.