Assertions: Difference between revisions

Content added Content deleted
(→‎{{header|MATLAB}}: works also with Octave)
No edit summary
Line 785: Line 785:


<lang vb>Debug.Assert i = 42</lang>
<lang vb>Debug.Assert i = 42</lang>

=={{header|XPL0}}==
XPL0 does not have an assert command. The equivalent is usually
synthesized something like this.

<lang XPL0>proc Fatal(Str); \Display error message and terminate program
char Str;
[\return; uncomment this if "assertions" are to be disabled
SetVid(3); \set normal text display if program uses graphics
Text(0, Str); \display error message
ChOut(0, 7); \sound the bell
exit 1; \terminate the program; pass optional error code to DOS
];

if X#42 then Fatal("X#42");</lang>