macro_rules! require_eq {
    ($value1: expr, $value2: expr, $error_code:expr $(,)?) => { ... };
    ($value1: expr, $value2: expr $(,)?) => { ... };
}
Expand description

Ensures two NON-PUBKEY values are equal.

Use require_keys_eq to compare two pubkeys.

Can be used with or without a custom error code.

§Example

pub fn set_data(ctx: Context<SetData>, data: u64) -> Result<()> {
    require_eq!(ctx.accounts.data.data, 0);
    ctx.accounts.data.data = data;
    Ok(())
}