Booleans
The boolean type in Cairo is specified using bool
, and has two possible values: true
and false
.
Using integer literals for bool
declarations is not allowed.
Example
fn main() {
// let t: bool = 1 <-- fails to compile
let t = true; // bool type inferred from context annotation
assert!(t);
}
You can experiment with this example in cairovm.codes and read more about booleans in the Cairo Book. |