Assignment Shortcuts
\The Sandbox \PB History & Future \New in PB 3 \Assignment Shortcuts
Undocumented
Changes
Migration Issues
About Toolbars
Accelerator Keys
Assignment
Shortcuts
EditMask Object
Graphs
MAPI
Object Features
New & Modified
Functions
App Object
Attributes
New Data Types
New DataWindow
Features
New Events
Menu Painter
Features
PowerScript
Features
User Object
Event
Window Attributes
Preference
Options
Command Line
Transaction
Object
WATCOM SQL

PowerScript provides the following shortcuts you can use to assign values to variables. They have slight performance advantages over their equivalents:

This assignment shortcut

Used here

Is 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

If you allow dashes in variable names, leave a space before -- and -= (if you don't, PowerScript considers the minus sign part of a variable name).

    Tip     You can use the assignment shortcuts only in assignment statements. They cannot be used with other operators in a statement.

Examples

These are valid assignment statements:

    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.

The last assignment statement below is invalid, because ++ is not used by itself in the assignment:

    int i, j
    i = 12
    j = i ++           // INVALID, ++ is not used by itself.

The following statement using ++ is valid, because ++ is used by itself in the assignment:

    int    i, j
    i = 12
    i ++           //VALID, ++ is used by itself
    j = i

Related topic

    Assignment

PBL Peeper PB Help PB History
& Future About Us Feedback Site Map

Google
 
Web www.techno-kitten.com
www.sybase.com