Assigns values to variables or object properties or object references to object variables.
variablename = expression
Argument  | 
Description  | 
|---|---|
variablename  | 
The name of the variable or object property to which you want to assign a value. Variablename can include dot notation to qualify the variable with one or more object names.  | 
expression  | 
An expression whose datatype is compatible with variablename.  | 
Use assignment statements to assign values to variables. To assign a value to a variable anywhere in a script, use the equal sign (=). For example:
String1 = "Part is out of stock"
TaxRate = .05
Since the equal sign is also a logical operator, you cannot assign more than one variable in a single statement. For example, the following statement does not assign the value 0 to A and B:
A=B=0 // This will not assign 0 to A and B.
This statement first evaluates B=0 to true or FALSE and
then tries to assign this boolean value to A. When A is not a boolean
variable, this line produces an error when compiled.
You can assign multiple array values with one statement, such as:
int Arr[]
Arr = {1, 2, 3, 4}
You can also copy array contents. For example, this statement copies the contents of Arr2 into array Arr1:
Arr1 = Arr2
The PowerScript shortcuts for assigning values to variables in the following table have slight performance advantages over their equivalents.
Assignment  | 
Example  | 
Equivalent to  | 
|---|---|---|
++  | 
i ++  | 
i = i + 1  | 
--  | 
i --  | 
i = i - 1  | 
+=  | 
i += 3  | 
i = i + 3  | 
-=  | 
i -= 3  | 
i = i -3  | 
*=  | 
i *= 3  | 
i = i * 3  | 
/=  | 
i /= 3  | 
i = i / 3  | 
^=  | 
i ^=3  | 
i = i ^ 3  | 
Unless you have prohibited the use of dashes in variable names,
you must leave a space before -- and -=. If
you do not, PowerScript reads the minus sign as part of a variable
name. For more information, see “Identifier names”. 
Example 1 These statements each assign a value to the variable ld_date:
date ld_date
ld_date = Today( )
ld_date = 2006-01-01
ld_date = Date("January 1, 2006")
Example 2 These statements assign the parent of the current control to a window variable:
window lw_current_window
lw_current_window = Parent
Example 3 This statement makes a CheckBox invisible:
cbk_on.Visible = FALSE
Example 4 This statement is not an assignment—it tests the value of the string in the SingleLineEdit sle_emp:
IF sle_emp.Text = "N" THEN Open(win_1)
Example 5 These statements concatenate two strings and assign the value to the string Text1:
string Text1
Text1 = sle_emp.Text+".DAT"
Example 6 These assignments use operator shortcuts:
int i = 4
i ++ // i is now 5.
i -- // i is 4 again.
i += 10 // i is now 14.
i /= 2 // i is now 7.
These shortcuts can be used only in pure assignment statements. They cannot be used with other operators in a statement. For example, the following is invalid:
int i, j
i = 12
j = i ++ // INVALID
The following is valid, because ++ is used by itself in the assignment:
int i, j
i = 12
i ++
j = i