RepeatWith |
Type | control structure |
Dictionary | LCB |
Library | LiveCode Builder |
Syntax | repeat with <Counter> from <Start> ( up | down ) to <Finish> [ by <Step> ]
<StatementList>
end repeat
|
Associations | com.livecode.language |
Summary | Executes a list of statements
|
Parameters | Name | Type | Description |
---|
Counter | | A numeric variable.
|
Start | | The initial value of Counter
|
Finish | | The boundary value of Counter
|
Step | | The value by which to increase or decrease the Counter
|
StatementList | | A set of statements.
|
|
Example | public handler Factorial(in pOperand as integer) as number
if pOperand < 1 then
return 0
end if
variable tTotal as number
put 1 into tTotal
variable tCounter as integer
repeat with tCounter from 1 up to pOperand
multiply tTotal by tCounter
end repeat
return tCounter
end handler
|
Description | Use the repeat with Counter structure to execute a set of statements until the value of Counter reaches or crosses (depending on iteration direction) the value of Finish. The counter is increased (or decreased) by Step on each iteration of the loop.
|