boolean

Boolean operations. The bool type is a primitive type in Cairo representing a boolean value that can be either true or false. This module provides trait implementations for boolean operations. # Examples Basic boolean operations:


let value = true;
assert!(value == true);
assert!(!value == false);

Converting to optional values with BoolTrait::then_some:

use core::boolean::BoolTrait;

let bool_value = true;
let result = bool_value.then_some(42_u8);
assert!(result == Option::Some(42));

let bool_value = false;
let result = bool_value.then_some(42_u8);
assert!(result == Option::None);

Fully qualified path: core::boolean

Traits