forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexit-repeat.lcdoc
More file actions
57 lines (42 loc) · 1.67 KB
/
Copy pathexit-repeat.lcdoc
File metadata and controls
57 lines (42 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Name: exit repeat
Type: control structure
Syntax: exit repeat
Summary:
Skips the rest of the current <repeat> <loop> and goes to the
<statement> following the <end repeat>.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
if x > 0 then exit repeat
Description:
Use the <exit repeat> <control structure> to skip the rest of a <repeat>
<loop>.
**Form:** The <exit repeat> <statement> appears on a line by itself,
anywhere inside a <repeat> <control structure>.
After an <exit repeat> <statement>, none of the remaining
<statement|statements> in the current <loop> is <execute|executed>, and
any more <loop|loops> are skipped. The <handler> <resume|resumes>
<execute|executing> at the first <statement> after the end of the
<repeat> <loop>.
Usually, <exit repeat> is used within an <if> <control structure>, so
that the <loop> stops if a condition is true and continues if the
condition is false. This example reads a file in chunks and stops
the <loop> when it encounters the end of file or if the file is empty:
constant kChunk = 1024
open file tFile for binary read
repeat
read from file tFile for kChunk
put the result into tResult
if tResult is empty or tResult is "eof" then
ProcessFileChunk it
end if
if tResult is not empty then
exit repeat
end if
end repeat
close file tFile
References: exit (control structure), next repeat (control structure),
repeat (control structure), if (control structure), handler (glossary),
resume (glossary), statement (glossary), loop (glossary),
execute (glossary), control structure (glossary), end repeat (keyword)