up previous next
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 fuctions
indent, IndentStr
are useful for printing out long
lists of values: they print 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.
/**/ 1+2; // an expression at top level
3
/**/ println 1; println 2;
1
2
/**/ print 1; print 2;
12
/**/ println [11,22];
[11, 22]
/**/ indent([11,22]);
[
11,
22
]
|