Difference between revisions of "Throw"

From Mesham
Jump to navigationJump to search
m
m
Line 17: Line 17:
 
In this example, a programmer defined error ''an error'' is thrown and caught.
 
In this example, a programmer defined error ''an error'' is thrown and caught.
  
''Since: Version 0.41b''
+
''Since: Version 0.5''
  
 
[[Category:sequential]]
 
[[Category:sequential]]

Revision as of 18:11, 13 January 2013

Syntax

throw errorstring;

Semantics

Will throw the error string, and either cause termination of the program or, if caught by a try catch block, will be dealt with.

Example

#include <io>
try {
   throw "an error"
} catch "an error" {
   print("Error occurred!\n");
};

In this example, a programmer defined error an error is thrown and caught.

Since: Version 0.5