warning

Print a warning message

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

warning(message)

Description

warning(message) prints the message with the prefix "Warning:".

warning may be used to print information about potential problems in an algorithm. E.g., it is used in limit to provide hints.

Examples

Example 1

A warning:

warning("You should not do this!"):
Warning: You should not do this!

Example 2

This example shows a simple procedure which divides two numbers. If the second argument is omitted, a warning is printed and the computation continues:

mydivide := proc(x, y)
begin
  if args(0) < 2 then
    warning("Denominator not given, using 1.");
    y := 1;
  end_if:
  x/y
end_proc:
mydivide(10)
Warning: Denominator not given, using 1. [mydivide]

Parameters

message

A character string

Return Values

Void object of type DOM_NULL.

See Also

MuPAD Functions

Was this topic helpful?