up previous next
Tutorial-02: variables, assignment
|
Tutorial-02: variables, assignment
Tutorial-02 for CoCoA-5
CoCoA-5 includes its own "imperative" programming language.
Values you plan to use in future computations need to be "stored" in
variables; the act of storing a value in a variable is also called
"assignment". CoCoA-5 uses the "colon-equals" operator to indicate
assignment.
A variable name must start with a letter, and may contain letters,
digits, and the underscore character. We recommend using names
which are mnemonic (but hopefully not too long).
The most basic types in CoCoA-5 are integers, rationals and strings.
A number written in "decimal notation" is automatically converted to
a rational number.