break

Skips the rest of the current switch control structure and goes to the statement following the end switch.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

break

# Examples

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.

**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 statements is executed. The break control structure ends this set of statements and breaks out of the switch control structure.

If no break appears, LiveCode executes each set of 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 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, it has the same effect as the exit control structure.

# Tags

# See

- **keyword:** case, end if, end switch - **function:** commandNames - **glossary:** statement, command, control structure, execute - **control structure:** exit, switch