PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Assert Statements

Assert Statements

Assert Statements are a feature.

Assert Statements can be built into the language or included in a standard library.


Languages with Assert Statements include Java, C, Jule

Example from Java:
// By default, assertions are disabled // java 鈥揺nableassertions Test int score = 10; assert score >= 10 : " Below"; System.out.println("score is "+score);
Example from C:
#include <assert.h> int i, a[10]; for (i = 0; i < 10; ++i) { assert(0 <= i && i < 10); a[i] = 10-i; } for (i = 0; i < 10; ++i) { assert(0 <= i && i < 10); assert(0 <= a[i] && a[i] < 10); a[a[i]] = a[i]; }
Example from Jule:
use std::debug use std::debug::assert::{assert} fn main() { std::debug::ENABLE = true let x = 200 assert(x < 200) }
print-debugging-feature.html 路 assert-statements-feature.html 路 case-insensitive-identifiers-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com