Loops
Introduction to using loops in sCrypt contracts.
Bitcoin Script does not provide built-in loop functionality. sCrypt implements loops by repeating the loop's internal data script n times.
Since loop unfolding occurs at compile time, the number of iterations must be known at compile time and must be a constant.
Loop Increment
Loop increment refers to the operation of incrementing or decrementing the loop variable within the loop body.
Adding Conditions Inside the Loop
Exiting the Loop
To exit the loop within the loop body, use the following method: