Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Keywords

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

repeat with

repeat with variableName = ¬
    integer1 to integer2
    statements
end repeat

repeat with variableName = ¬
    integer1 down to integer2
    statements
end repeat


The statements in a repeat with structure repeat until a variable with an initial value of integer1 is greater than (or, in the case of down to, less than) the number integer2.


The value of the variable increases (or decreases) by 1 during each iteration of the repeat loop.


If HyperCard executes an exit repeat statement in the loop, it continues running the handler starting from the first statement after end repeat. If HyperCard executes a next repeat statement, it returns immediately to the beginning of the repeat loop and increases (or decreases) the value of the variable.


Demo Script

on mouseUp
   show bkgnd field "demo field"
   put return & spaces(25) & "Counting down to 0:  10" ¬
   into bkgnd field "demo field"
   repeat with theCount = 10 down to 0
     put theCount into last word of bkgnd field "demo field"
     wait 15 ticks
   end repeat
   flash
   wait 20
   hide bkgnd field "demo field"
   put empty into bkgnd field "demo field"
 end mouseUp

Placeholders

variableName
Any text string, without quotation marks, that represents the name of a variable that you want to use:

index
N
cardNumber
total


statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« repeat while | HyperTalk Reference | return »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View