Click or drag to resize

WHILE Statement

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
WHILE Statement

WHILE statements provide a means of repeating blocks of code a variable number of times, depending on the conditions that the blocks are run under.

Syntax

Alchemy
WHILE condition_A
do_A

Nomenclature

condition_A Some logic expression that can be evaluated to give a boolean result.
do_A The code to execute while condition_A is true. In most cases, do_A will change condition_A at some point to make it false, breaking the loop.

Example

The following example sums each of the integers between 0 and 9.

Alchemy
$counter = 0;
WHILE $counter < 9
BEGIN
  $sum = $sum + counter;
  $counter = $counter + 1;
END