Assertions are a way of breaking out of code when there is an error or an unexpected input.

Some languages throw exceptions and some treat it as a break point.



Task

Show an assertion in your language by asserting that an integer variable is equal to 42.




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");