#### Revision [17456]

This is an old revision of KeyPgOpAdd made by CountingPine on 2015-03-25 09:00:03.

### Operator + (Addition)

Sums two expressions

**Syntax:**

KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgInteger integer, KeyPgByref byref*rhs*KeyPgAs as KeyPgInteger integer ) KeyPgAs as KeyPgInteger integerKeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgUinteger uinteger, KeyPgByref byref*rhs*KeyPgAs as KeyPgUinteger uinteger ) KeyPgAs as KeyPgUinteger uintegerKeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgLongint longint, KeyPgByref byref*rhs*KeyPgAs as KeyPgLongint longint ) KeyPgAs as KeyPgLongint longintKeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgUlongint ulongint, KeyPgByref byref*rhs*KeyPgAs as KeyPgUlongint ulongint ) KeyPgAs as KeyPgUlongint ulongint
KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgSingle single, KeyPgByref byref*rhs*KeyPgAs as KeyPgSingle single ) KeyPgAs as KeyPgSingle singleKeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgDouble double, KeyPgByref byref*rhs*KeyPgAs as KeyPgDouble double ) KeyPgAs as KeyPgDouble double
KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as*T*KeyPgPointer Pointer, KeyPgByref byref*rhs*KeyPgAs as KeyPgInteger integer ) KeyPgAs as*T*KeyPgPointer PointerKeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*rhs*KeyPgAs as KeyPgInteger integer, KeyPgByref byref*lhs*KeyPgAs as*T*KeyPgPointer Pointer ) KeyPgAs as*T*KeyPgPointer Pointer
KeyPgDeclare declare KeyPgOperator operator

KeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as*T*, KeyPgByref byref*rhs*KeyPgAs as KeyPgInteger integer ) KeyPgAs as*T*KeyPgDeclare declare KeyPgOperator operator

**+**( KeyPgByref byref*lhs*KeyPgAs as KeyPgInteger integer, KeyPgByref byref*rhs*KeyPgAs as*T*) KeyPgAs as*T***Usage:**

*result*=*lhs***+**

*rhs*

**Parameters:**

*lhs*
The left-hand side expression to sum.

*rhs*
The right-hand side expression to sum.

*T*
Any pointer type.

**Return Value:**

Returns the sum of two expressions.

**Description:**

When the left and right-hand side expressions are numeric values,

**returns the sum of the two values.**`Operator +`(Add)
When the left and right-hand side expressions are string values,

**concatenates the two strings and returns the result.**`Operator +`(Add)
If an integral value

`is added to a`*n*`type, the operator performs pointer arithmetic on the address, returning the memory position of a`*T*KeyPgPointer Pointer`value,`*T*`indices away (assuming`*n*`is within bounds of a contiguous array of`*n*`values). This behaves differently from numeric addition, because the`*T*`KeyPgInteger Integer`value is scaled by`KeyPgSizeof Sizeof(`.*T*)
Neither operand is modified in any way.

This operator can be overloaded to accept user-defined types.

**Examples:**

Dim n As Single

n = 4.75 + 5.25

Print n

n = 4.75 + 5.25

Print n

will produce the output:

10

**Dialect Differences:**

- In the
*CompilerOptlang -lang qb*dialect, this operator cannot be overloaded.

**Differences from QB:**

- None

**See also:**

Back to Arithmetic Operators

Back to Operators