warning
-- print a warning
messagewarning(
message)
prints the warning
message
.
warning(message)
message |
- | a character string |
the void object of type DOM_NULL
.
The formatting of the output of warning
is sensitive to
the environment variable TEXTWIDTH
.
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. Cf.
example 3.warning
is a function of the system kernel.A warning:
>> warning("You should not do this!"):
Warning: You should not do this!
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] 10
In the following call, the requested limit depends on
the paramater c
:
>> limit(exp(c*x), x = infinity);
Warning: cannot determine sign of c [stdlib::limit::limitMRV] limit(exp(c x), x = infinity)
The user can react to the warning by assuming some property for c
:
>> assume(c < 0): limit(exp(c*x), x = infinity);
0
>> assume(c > 0): limit(exp(c*x), x = infinity);
infinity
>> unassume(c):