assert Summary Aborts the program if the provided condition is not true. Signatures Click on a signature to select it and view its documentation. void assert(bool condition) void assert(bool condition, string message) Usage void assert(bool condition) void assert(bool condition, string message) Parameters condition The condition to test. Parameters condition The condition to test. message The message to provide if the condition is not true. Description Aborts the program (by throwing System.Errors.AssertError) if the provided condition is not true. Aborts the program (by throwing System.Errors.AssertError) if the provided condition is not true. Examples Basic Usage 12345678910import System;import System.Assert;import System.Errors; try { assert(1 == 0);}catch(AssertError e) { Console.log(e);} Basic Usage 12345678910import System;import System.Assert;import System.Errors; try { assert(1 == 0, "1 does not equal 0");}catch(AssertError e) { Console.log(e);} Share HTML | BBCode | Direct Link