Previous Page Next Page Contents

warning -- print a warning message

Introduction

warning(message) prints the warning message.

Call(s)

warning(message)

Parameters

message - a character string

Returns

the void object of type DOM_NULL.

Side Effects

The formatting of the output of warning is sensitive to the environment variable TEXTWIDTH.

Related Functions

error, print, userinfo

Details

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]
      
                                    10
      

Example 3

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):

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000