# Language Reference - Appendix

Operators |

The information below describes the traditional operators (e.g. + - * /) you can use in PxPlus, along with other operators for which support has been added in recent versions (e.g. the auto-increment and decrement operators, assignment operators, the LIKE Operator, and the Apostrophe Operator).

See Numeric Values and String Values for additional information on the use of some of these operators.

## Arithmetic Operators

The following operators are used to perform calculations:

| + | Where: A + B adds A to B
| - | Where: A - B subtracts B from A
| * | Where: A * B multiplies A by B
| / | Where: A / B divides A by B
| ^ | Where: A ^ B raises A to the power of B (** is equivalent to ^)
| | | Where: A | B divides A's remainder by B

## Assignment Operators

The following assignment operators are included in the general syntax of the language:

Operator | Meaning | Description
+= | Add To | Can be used with numerics or strings. Example:
Numeric: | A+=1 is the same as A=A+1
String: | A$+="G" is the same as A$=A$+"G"
-= | Subtract From | Not valid for strings. Example:
Numeric Only: | B-=A+1 is the same as B=B-(A+1)
*= | Multiply By | Can be used with numerics or strings. Example:
Numeric: | B*=A+1 is the same as B=B*(A+1)
String: | A$*=5 is the same as A$=A$+A$+A$+A$+A$
/= | Divide By | Not valid with strings. Example:
Numeric Only: | B/=A+1 is the same as B=B/(A+1)
^= | Exponentiation | Raise to. Not valid with strings. Example:
Numeric Only: | B^=A is the same as B=B^A
|= | Modulus/Remainder from Division | Not valid with strings. Example:
Numeric Only: | B|=A is the same as B=MOD(B,A)

## Auto

Increment and Decrement
In addition to the assignment operators, there are increment and decrement features:

| ++ | Auto-increment (pre-increment when prefixed to variable name, post-increment if suffixed); e.g. ++variable or variable++.
| -- | Auto-decrement (pre-decrement when prefixed to variable name, post-decrement if suffixed); e.g.--variable or variable--.

#### Note:
If an error occurs during execution of your directive, no increment or decrement takes place. (This is true for both pre- and post-operations.)
With pre-increment or decrement, the value returned is the value of the variable after the increment or decrement.
With post-increment or decrement, the value returned is the value of the variable before the increment or decrement. After your directive is executed, your variable is incremented or decremented by 1.

Example:

> A=0, Y$=""
> READ (1,IND=A++,ERR=*NEXT)X$; Y$+=X$; GOTO *SAME
> or
> Y$+=RCD(1,IND=A++,ERR=*NEXT); GOTO *SAME

See Labels/Logical Statement References.

## LIKE Operator

Use the LIKE operator for string comparisons. The PxPlus default (with the 'TL' system parameter set to Off) is to take the string expression on the left and compare it to the string mask on the right. In the default mode, you can apply all the regular expression rules of the MSK( ) function to using the LIKE operator. Use the following format:

> IF A$ LIKE "ABC" THEN ...

To make your conversions from Thoroughbred® easier, set 'TL' to On. With this parameter On, the LIKE operator emulates the Thoroughbred® matching of patterns.

See SET_PARAM directive, MSK( ) function and 'TL' system parameter.

## Apostrophe Operator

The apostrophe operator is used to assign, retrieve, list, and make dynamic changes to a given control or object's properties.

For the syntax and use of the apostrophe, see Apostrophe Operator.

Thoroughbred® is a registered trademark of Thoroughbred Software International Inc.