up previous next
block

group several commands into a single command

Syntax
block C_1; ... ; C_n EndBlock;

where each C_i is a command.

Description
The block command executes the commands as if they where one command. What this means in practice is that CoCoA will not print a string of dashes after executing each C_i . Thus, Block is used on-the-fly and not inside user-defined functions. (It has nothing to do with declaration of local variables, for instance, as one might infer from some other computer languages.) The following example should make the use of Block clear:

Example
/**/  Print "hello "; Print "world";
hello world
-------------------------------
/**/  Block
/**/    Print "hello ";
/**/    Print "world";
/**/  EndBlock;
hello world
-------------------------------
/**/  Block
/**/    PrintLn GCD([12, 24, 96]);
/**/    PrintLn LCM([12, 24, 96]);
/**/    PrintLn GCD([x+y, x^2-y^2]);
/**/    Print LCM([x+y, x^2-y^2]);
/**/  EndBlock;

12
96
x + y
x^2 - y^2
-------------------------------