This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathbreak.lcdoc
More file actions
63 lines (47 loc) · 2.02 KB
/
break.lcdoc
File metadata and controls
63 lines (47 loc) · 2.02 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
57
58
59
60
61
62
Name: break
Synonyms: exit switch
Type: control structure
Syntax: break
Summary:
Skips the rest of the current <switch> <control structure|structure> and
goes to the <statement> following the <end switch>.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
switch thisVariable
case true
doSomething
break
case false
doSomethingElse
break
end switch
Description:
Use the <break> <control structure> to end each case section in a
<switch> <control structure|structure>.
**Form:** The word break appears on a line by itself, within a <case> section of
a <switch> <control structure>.
A <switch> <control structure> consists of one or more conditions. For
each condition, a set of <statement|statements> is executed. The <break>
<control structure> ends this set of <statement|statements> and breaks
out of the <switch> <control structure|structure>.
If no <break> appears, LiveCode <execute|executes> each set of
<statement|statements> in the following case sections, whether or not
the condition in the case is true. This means that if you leave out the
<break> <control structure>, more than one case in the <switch>
<statement> may be executed. Occasionally, this is desirable, but
usually you should include the <break> <control structure> at the end of
each case, to ensure that only one set of <statement|statements> is
executed.
>*Note:* The <break> <control structure> is implemented internally as a
> <command> and appears in the <commandNames>.
The <break> <command> should not be used outside a <switch> structure:
such use is nonstandard, so it may not be apparent to whoever reads the
code that the use is intentional. If it appears outside a <switch>
<control structure|structure>, it has the same effect as the <exit>
<control structure>.
References: exit (control structure), switch (control structure),
commandNames (function), statement (glossary), command (glossary),
control structure (glossary), execute (glossary), case (keyword),
end if (keyword), end switch (keyword)