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

Function for_i_in_0_

pub fn for_i_in_0_<Env1, Env2>(
    max: u32,
    MAX: u32,
    f_within: fn[Env1](u32),
    f_after_max: fn[Env2](u32),
    assert_max_lte_MAX: bool,
)

Iterates between loop bounds and conditionally executes functions according to the below explanation, 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 ------

       f_after_max is executed for max <= i < MAX  

<= MAX ------

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