Loop
Loop steps are used to wait for a particular message.
A loop is written
#![allow(unused)] fn main() { repeat_step ->? stop_step }
and will be matched when :
-
The step representing the stopping condition
stop_step
is matched, or -
A message matching
repeat_step
is matched and then the same loop must be matched again#![allow(unused)] fn main() { repeat_step ->? stop_step }
For instance,
#![allow(unused)] fn main() { ( preendorse __ __ __ [__] || endorse __ __ __ [__] ) ->? propose __ __ __ [__] }
waits for a proposal message and forwards any preendorsement and endorsement messages in the meantime.