You use declaration statements to identify and make procedures, variables, constants, and more. When you declare a programming construct, you can also identify its data type, access level, and scope. See Declared Element Qualities for more information,.
An executable statement causes changes. It can move to different parts of the code, execute other statements again and again, or calculate a result.
An assignment statement is a special type of executable statement.
It gets the value on the right side of the assignment operator (
=), then stores that in the element on the left side.
An example follows.
x = 42
Here the assignment statement stores the literal value 42 in the variable x.
Data types and conversions
You can give many variables the same value with one statement.
Chained assignment uses a special operator (
You put this operator after each of the variables, then put an expression last.
You cannot use other assignment operators with this statement.
An example follows.
' Reset the coordinates. x := y := z := 0.0
Note: You also can use the operator
:= in arguments passed to procedures.
See Parameter List for more information.
Statements divided into many lines
Most statements are short, but can become too long to read easily.
You can divide a long statement into two or more lines of code.
You write a space and an underscore (
_) before the end-of-line.
In the example that follows, a name and address returned from a database table are printed to a label.
#address_label.Text = _ #row!Name & $N & _ #row!Address
Divided statements without the underscore
Some conditions let you continue a statement on a different line without the underscore character (
In the table that follows are the elements of a statement and conditions in which the compiler ignores an end-of-line.
|After a comma (
|After a left parenthesis (
|After a left brace (
|After a modifier that starts with the at-sign (
For information about using comments after a line continuation sequence, see the section below.
comments and divided statements