CheckArgs - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Procedures and Functions : CheckArgs

CheckArgs

validate a list of Maple expressions

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

CheckArgs(exprs, tests)

Parameters

exprs

-

list of expressions to validate

tests

-

list of tests to apply

Description

• 

The CheckArgs routine returns true if all tests pass, and returns false otherwise.

• 

CheckArgs is intended to be used inside an ASSERT() call to perform simple validation of the arguments to a procedure:

ASSERT( CheckArgs( [args], [tests] ), `CheckArgs/Msg` );

  

The global variable `CheckArgs/Msg` is set to a diagnostic message indicating the first argument whose test failed. The message appears only if assertions are enabled and some test fails.

  

The tests argument consists of a list of tests, which can be either types or predicates, that is, one-argument functions that return true or false. If the procedure does not return false, then the test passes, otherwise it fails. CheckArgs applies the nth test (that is, the nth element of tests) to the nth element of exprs. Thus, CheckArgs cannot be used for tests involving more than one argument at a time.

Examples

CheckArgshello,1,string,postint

true

(1)

See Also

assert

procedure

type

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam