up previous next
Tutorial-04: printing

Tutorial-04: printing


Tutorial-04 for CoCoA-5

The way CoCoA-5 can show us the results of its computation is by (so-called) "printing" them on the screen.

At top level, if you type in an expression for a computation, CoCoA-5 will evaluate the expression, and then automatically print out the answer. This is convenient for interactive use.

Inside a function definition you must use explicitly a printing command: the two fundamental printing commands are println and print . The only difference between them is that the first command also prints out a "newline" at the end; this is usually what is desired.

The procedure indent is useful for printing out long lists of values: it prints a newline after each list entry (whereas print and println will print all entries on the same line).

To help comprehend the true size of large integers or rationals there is the function FloatStr which prints out the value using an easy-to-understand floating-point format.
See Also