For the complete documentation index, see llms.txt.
aztec-nr - noir_aztec::protocol::utils::for_loop

Function for_i_only_in_0_

pub fn for_i_only_in_0_<Env>(
    max: u32,
    MAX: u32,
    f_within: fn[Env](u32),
    assert_max_lte_MAX: bool,
)

Iterates between loop bounds and conditionally executes a function for min <= i < max, where:

  • max is a dynamic loop bound (known only at runtime).
  • MAX is a static loop bound (known at compile time).

0 ------

       f_within is executed for 0 <= i < max    

<= max ------ <= MAX ------

Lambda functions of the form |i| { my_array[i].assert_empty() } (for example) can be specified.

Strangely, this sometimes results in many more constraints than for_i_in_0_ with the for_loop_no_op function. But other times, this one wins. I am confused.