up previous next
Tutorial-03: arithmetic operators

Tutorial-03: arithmetic operators

Syntax
?tutorial

Description
Tutorial-03 for CoCoA-5

CoCoA-5 includes its own imperative programming language. The language includes some fairly natural arithmetic operators (usually similar to other computer algebra systems).

The main peculiarities are: colon-equals representing assignment, less-than greater-than representing not-equals, and the words "and", "or" and "not" representing the boolean operations.

To see a complete list of all infix operators, type the manual query ?operator

Example
/**/ A := 1;          // assign the integer 1 to the variable "A"
/**/ 1+2*3^4;         // addition, multiplication, power
163
/**/ 1-2/3;           // subtraction, division
1/3
/**/ (A > 0) and (A < 2);  // greater-than, less-than, boolean "and"
true
/**/ (A >= 0) or (A <= 2); // greater-or-equal, less-or-equal, boolean "or"
true
/**/ (A = 1) or (A <> 2);  // equal, not-equal
true
/**/ not(A > -1 and A < 3); // boolean "not"
false

See Also