Next: , Previous: , Up: I/O statements   [Contents][Index]

4.5.2 Writing to standard output

coNCePTuaL’s OUTPUT keyword is used to write a message from one or more source tasks (see Source tasks) to the standard output device. This is useful for providing progress reports during the execution of long-running coNCePTuaL programs. An <output_stmt> looks like this:

<output_stmt> ::= <source_task>
<expr> | <string_or_log_comment>
[ AND    <expr> | <string_or_log_comment>]*

The following are some sample <output_stmt>s:

TASK 0 OUTPUTS "Hello, world!"

TASKS nr SUCH THAT nr>0 OUTPUT nr AND "'s parent is " AND nr>>1 AND
" and its children are " AND nr<<1 AND " and " AND nr<<1+1

ALL TASKS me OUTPUT "Task " AND me AND " is running on host " AND THE
VALUE OF "Host name" AND " and plans to send to task " AND (me+1) MOD

OUTPUT does not implicitly output spaces between terms. Hence, ‘OUTPUT "Yes" AND "No"’ will output “YesNo”, not “Yes No”. Although it is unlikely that a program would ever need to output two arithmetic expressions with no intervening text, an empty string can be used for this purpose: ‘OUTPUT 6 AND "" AND 3’.

An <output_stmt> implicitly outputs a newline character at the end. Additional newline characters can be output by embedding ‘\n’ in a string. (see Primitives.) coNCePTuaL does not provide a means for suppressing the newline, however.

Scott Pakin,