Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
ASSERT - check assertions
Calling Sequence
ASSERT(cond, string)
ASSERT(cond)
Parameters
cond
-
expression evaluating to true or false
string
Description
ASSERT is used to guarantee pre- and post-conditions while a Maple procedure is executing.
If the first argument evaluates to false, an error is generated and the second argument is printed in order to identify the nature of the failure. Such an error cannot be trapped via try-catch.
If the first argument evaluates to true, ASSERT returns NULL.
The ASSERT mechanism can be turned on and off with kernelopts. If turned off, the overhead of processing an ASSERT is negligible.
Thread Safety
The ASSERT command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Examples
Query the current state.
Turn assertions on (kernelopts returns its previous value).
The following results in assertion failures.
Error, assertion failed, x must be an integer
Error, assertion failed, a is too small: 1
This assertion check will succeed.
Assertion failures are not trappable.
Turn assertions off (the previous value is returned again).
Now assertion failures are ignored.
See Also
kernelopts, try
Download Help Document