up previous next
1.6.2 Standard IO
***** NOT YET UPDATED TO CoCoA-5: follow with care *****

Standard IO is what takes places normally when one interacts with CoCoA. CoCoA accepts and interprets strings typed in by the user and prints out expressions. If E is a CoCoA object, then the command
    E;
causes the value of E to be printed to the CoCoA window. One may also use the functions print and println for more control over the format of the output.

The official devices that are being used here are DEV.STDIN and DEV.OUT . So for instance, the commands Get and print on can be used with the standard devices although they are really meant to be used with the other devices. Print E On DEV.OUT is synonymous with Print E . Also, one may use Get(DEV.STDIN,10) , for example, to get the next 10 characters typed in the CoCoA window. Thus, clever use of Get will allow your user-defined functions to prompt the user for input, but normal practice is to pass variables to a function as arguments to that function.