echo, print ...

Prev Next

Function Names

echo, print, print line

Description

The following functions compose the contents in the function parameters into one string and outputs them on the screen.
echo outputs the contents onto the screen, followed by new line. Indirect parameter passing is disabled, so parameter sets provided in the 1st function parameter will not be interpreted as individual function parameters but is considered as an actual parameter set value.
print line works like echo, but indirect parameter passing is enabled. E.g. print({a,1}); is treated as print(a,1);. print works like print line, but stays on the same line afterwards (no 'new line'.)

In addition of outputting the composed string onto the screen, it is available as return value, too.

Call as: procedure or function

Restrictions

Indirect parameter passing is disabled for function 'echo'.

Parameter count

Min 0

Parameters

No.TypeDescription
1, ...
input
all types Contents

Contents to be output

Return value

TypeDescription
string Composed string

Same contents as output to the console

Examples

    c[] = 3+5*2;
    a[] = echo( "Calculation: ", c[], " compared with 13 gives ", c[]==13, "." );
    echo("Return value: ", a[] );
    r[] = print("Note the line break ... " );
    print(r[]); // Repeat
    print ("in a[] at the end.");
    echo;
    echo;

    s[] = { "Calculation: ", c[], " compared with 13 gives ", c[]==13, "." };
    echo("Output parameter set with 'echo':");
    echo( s[] );
    echo("Output parameter set with 'print line':");
    print line( s[] );

Output

Calculation: 13 compared with 13 gives true.
Return value: Calculation: 13 compared with 13 gives true.

Note the line break ... Note the line break ... in a[] at the end.

Output parameter set with 'echo':
{'Calculation: ',13,' compared with 13 gives ',true,'.'}
Output parameter set with 'print line':
Calculation: 13 compared with 13 gives true.
Try it yourself: Open LIB_Function_echo.b4p in B4P_Examples.zip. Decompress before use.

See also

compose
compose line