exprv4:reference:functions:output_formatting_errors




Output, Formatting, and Error Functions

These functions write output, build formatted text, control output, or intentionally raise user errors.


clear()

Clears the active output target when possible.

Argument Type Description
none No arguments.

Returns: OK result.

Example:

clear();
print('Output was cleared');

enable_print(enabled)

Enables or disables output for the current output sink.

Argument Type Description
`enabled` any Converted to bool. True enables output; false disables output.

Returns: boolean-style number with the new enabled state.

Example:

enable_print(false);
print('hidden');
enable_print(true);
print('visible');

error(value, ...)

Builds an error message from all arguments and raises a user error.

Argument Type Description
`value` any First value to append to the message. Optional.
`…` any Additional values appended to the message.

Returns: does not return normally.

Example:

if(feed <= 0)
{
    error('Invalid feed: ', feed);
};

Writes values to the current output stream and appends a newline.

Argument Type Description
`value` any First value to print. Optional.
`…` any Additional values printed without an automatic separator.

Returns: OK result.

Example:

print('X=', x, ', Y=', y);

printf(format, value, ...)

Formats values, writes the result to output, and appends a newline.

Argument Type Description
`format` string Format string using brace-style placeholders. Optional; if omitted, only a newline is written.
`value` any First formatted value. Optional.
`…` any Additional formatted values.

Returns: OK result.

Example:

printf('X={}, Y={}', x, y);
printf('Tool {:d}', toolNumber);

Integer format specifiers convert numeric arguments to integer values before formatting.


sprint(value, ...)

Builds and returns text from all arguments.

Argument Type Description
`value` any First value. Optional.
`…` any Additional values appended without an automatic separator.

Returns: string.

Example:

text = sprint('X=', x, ', Y=', y);

sprintf(format, value, ...)

Formats values and returns the formatted text.

Argument Type Description
`format` string Format string using brace-style placeholders. Optional; if omitted, returns an empty string.
`value` any First formatted value. Optional.
`…` any Additional formatted values.

Returns: string.

Example:

line = sprintf('X={}, Y={}', x, y);

Previous: Strings

Next: Dialogs, Clipboard, Platform, and Paths

exprv4/reference/functions/output_formatting_errors.txt · Last modified: by 127.0.0.1

Page Tools