RepeatTimes |
Type | control structure |
Dictionary | LCB |
Library | LiveCode Builder |
Syntax | repeat <Count> times
<StatementList>
end repeat
|
Associations | com.livecode.language |
Summary | Executes a list of statements a given number of times.
|
Parameters | Name | Type | Description |
---|
Count | | An expression which evaluates to an integer.
|
StatementList | | A set of statements.
|
|
Example | public handler TwoToThePower(in pOperand as integer) as number
if pOperand is 0 then
return 1
end if
variable tCount as number
put the abs of pOperand into tCount
variable tResult as number
put 1 into tResult
repeat tCount times
multiply tResult by 2
end repeat
if pOperand < 0 then
return 1 / tResult
end if
return tResult
end handler
|
Description | Use the repeat Count times structure to execute a set of statements a given number of times, when the statements executed do not rely on knowing which iteration the repeat loop is on.
|