Declaring Variables

Function

Description

Byte myByte

UByte myUByte

Word myWord

UWord myUWord

DWord myDWord

UDWord myUDWord

QWord myQWord

UQWord myUQWord

Declares a variable of the specified name.  The variable is global to the entire expression (or Structure Function).  The expression will fail and abort if the variable name already exists.

Variable is initialized to zero at time of declaration and the value is returned.

Please see Expression Data Types for information on the data type sign and size.

 

Variable Operators

Operator

Description

=

Assignment / equals, sets the variable's value.

+=

Equivalent to variable = variable + <expression>.  See Arithmetic Operators for more information.

-=

Equivalent to variable = variable - <expression>.  See Arithmetic Operators for more information.

*=

Equivalent to variable = variable * <expression>.  See Arithmetic Operators for more information.

/=

Equivalent to variable = variable / <expression>.  See Arithmetic Operators for more information.

%=

Equivalent to variable = variable % <expression>.  See Arithmetic Operators for more information.

&=

Equivalent to variable = variable & <expression>.  See Bitwise Operators for more information.

|=

Equivalent to variable = variable | <expression>.  See Bitwise Operators for more information.

^=

Equivalent to variable = variable ^ <expression>.  See Bitwise Operators for more information.

<<=

Equivalent to variable = variable << <expression>.  See Arithmetic Operators for more information.

>>=

Equivalent to variable = variable >> <expression>.  See Arithmetic Operators for more information.

++

Equivalent to variable = variable + 1

--

Equivalent to variable = variable - 1

 

Examples

UQWord i;
UWord count;
for (i=0; i<100; i++)
{
    count += __getUByteAt(i);
};
count;

More Information