Identifier names
Description
You use identifiers to name variables, labels, functions, windows,
controls, menus, and anything else you refer to in scripts.
Syntax
Rules for identifiers:
-
Must start with a letter or an _ (underscore)
-
Cannot be reserved words (see Reserved words)
-
Can have up to 40 characters but no spaces
-
Are not case sensitive (PART, Part, and part are
identical) -
Can include any combination of letters, numbers, and these
special characters:– Dash
_ Underscore
$ Dollar sign
# Number sign
% Percent sign
Usage
By default, PowerBuilder allows you to use dashes in all
identifiers, including in variable names in a script. However, this means
that when you use the subtraction operator or the — operator in a script,
you must surround it with spaces. If you do not, PowerBuilder interprets
the expression as an identifier name.
If you want to disallow dashes in variable names in scripts, you can
change the setting of the Allow Dashes in Identifiers option in the script
editor’s property sheet. As a result, you do not have to surround the
subtraction operator and the decrement assignment shortcut (–) with
spaces.
Be careful
If you disallow dashes and have previously used dashes in variable
names, you will get errors the next time you compile.
Examples
Valid identifiers
1 2 3 4 5 6 7 8 |
ABC_Code Child-Id FirstButton response35 pay-before%deductions$ ORDER_DATE Actual-$-amount Part# |
Invalid identifiers
1 2 3 |
2nd-quantity // Does not start with a letter ABC Code // Contains a space Child'sId // Contains invalid special character |