if_lte!
Run a block if one static scalar is less than or equal to another. Control flow
if_lte! lhs, rhs { ... }
Compares two static scalars as integers and runs the block once, in a fresh inner scope, if lhs <= rhs. Elements compare by their canonical value in [0, p).
Arguments
lhs,rhs- Static scalars or witness constants.
{ ... }- Required block. It may not end in a final expression; it can assign
mutvariables of the enclosing scopes.
Returns
Nothing, it is used as a statement.
Constraints
None of its own. Behaves the same in the static VM.
Example
(let x) static k = 2 let mut out = x if_lte! k, 2 { out = x + x } out
Notes
- Vector arguments fail; only scalars can be compared.
Used in the standard library
lattice/lattice_expand, mldsa/mldsa_sample_in_ball, typed/typed_varint_len