ooPIC Logo

Assignment Operators

Main Index
Language Idx
Back to top of pageDescription:
 Assigns the value of an expression to the a property of an Object. In Basic syntax, the optional keyword Let can precedes the Assignment Statement.
Back to top of pageSyntax:
 The following shows the format of the Assignment Statement syntax.
Visual Basic & BASICC & Java
[Let] <id> = <expression><id> = <expression>;

The following table lists the elements of the Assignment Statement syntax.
ElementDescription
<id>An Identifier that specifies which Variable or Object and property to be assigned a value.
<expression>Value assigned to the Variable or Object's property specified in <id>

Back to top of pageOperation:
 When an Assignment Statement is encountered during the program's execution, the value of the Object Property specified by the <id> element is assigned the value specified by the <expression> elements.

With some objects, such as serial ports or LCD Displays, it is useful to assign multiple values at once as a string of characters.  This can be done by assigning a string value.  I.E. A.Vstring = "Hello World".  When an Assignment Statement like this is encountered during the program's execution, the value of the Object Property specified by the <id> element is assigned the values of each character in the string sequentially.  See Chapter 13 of the Programmers guide for more detail.

Note: Assigning an expression of one numeric data type to a variable of a different numeric data type coerces the value of the expression into the data type of the resulting variable. I.E. If a Byte value of 3 was assigned to a Bit variable, the resulting Bit variable value would be 1 because it only has 1-bit to store its value in.

Back to top of pageRemarks:
 In the Basic syntax, the optional Let keyword is most often omitted.

The value specified by the <expression> element can be assigned to the Object's property specified by <id> only if they are of the same type.

Back to top of pageExample:
 The following example shows an Assignment Statement that sets the value of A to 5.
In the Basic syntax, the Let keyword is optional and both examples function identically.
Visual Basic & BASICC & Java
A = 5
A = 5;
Let A = 5

The following example shows an Assignment Statement that sets the value of A to the ASCII value of "T", then sets the value of A to the ASCII value of "e", then sets the value of A to the ASCII value of "s", then sets the value of A to the ASCII value of "t".
Visual Basic & BASICC & Java
A = "Test"
A = "Test";

Back to top of pageRelated Items:

 Using Strings. (Chapter 13 of the Programmers guide.)
Back to top of pageVersion History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


 

ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.