logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

start-loop - (program-flow)

Description

start-loop will execute code between start-loop and "end-loop" clauses certain number of times based on a condition specified and the usage of continue-loop and break-loop, which can be used in-between the two. <repeat> number (in "repeat" clause) specifies how many times to execute the loop (barring use of continue-loop and break-loop). <loop counter> (in "use" clause) is a number that by default starts with value of 1, and is incremented by 1 each time execution loops back to start-loop, unless "start-with" and/or "add" clauses are used. The end value of <loop counter> (just outside "end-loop") is the first value past the last loop. If <start with> (in "start-with" clause) is used, that's the initial value for <loop counter> (instead of the default 1), and if <add> is specified (in "add" clause), then <loop counter> is incremented by <add> each time execution loops back to start-loop (instead of the default 1). <add> can be positive or negative. If either of "start-with" or "add" clauses is used, then "use" must be specified.

Examples

Print numbers 0 through 19: start-loop repeat 20 use p start-with 0 print-out p @ end-loop A loop that is controlled via continue-loop and break-loop statements, displaying numbers from 1 through 30 but omitting those divisible with 3: set-number n set-number max = 30 start-loop set-number n add 1 if-true n every 3 continue-loop end-if if-true n greater-than max break-loop end-if print-out n end-loop

Name

start-loop - (program-flow)

Purpose

Loop execution based on a condition.

See Also

Program flow break-loopcall-handlercode-blockscontinue-loopdo-onceexit-handlerif-definedif-truequit-processreturn-handlerstart-loop See all documentation $DATE $VERSION GOLF(2gg)

Syntax

start-loop [ repeat <repeat> ] \ [ use <loop counter> \ [ start-with <start with> ] [ add <add> ] ] <any code> end-loop

See Also