assert

Summary

Aborts the program if the provided condition is not true.

Signatures

Click on a signature to select it and view its documentation.

Usage

void assert(bool condition)

Parameters

condition

The condition to test.

Description

Aborts the program (by throwing System.Exceptions.AssertError) if the provided condition is not true.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
import System;
import System.Assert;
import System.Exceptions;
 
try {
    assert(1 == 0);
}
catch(AssertError e) {
    Console.log(e);
}

Share

HTML | BBCode | Direct Link