Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.starknet.io/llms.txt

Use this file to discover all available pages before exploring further.

The unary logical negation operator !.

Signature

pub trait Not

Examples

An implementation of Not for Answer, which enables the use of ! to invert its value.
#[derive(Drop, PartialEq)]
enum Answer {
    Yes,
    No,
}

impl AnswerNot of Not {
    fn not(a: Answer) -> Answer {
        match a {
            Answer::Yes => Answer::No,
            Answer::No => Answer::Yes,
        }
    }
}

assert!(!Answer::Yes == Answer::No);
assert!(!Answer::No == Answer::Yes);

Trait functions

not

Performs the unary ! operation.

Signature

fn not(a: T) -> T

Examples

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