You'll learn about some basic operators and the meaning of an expression. The operators discussed here are the basic ones, more operators are provided by the Visual Basic 6 language but they are out of this lesson's scope. I will explain them later.

**Table:**Operators and their meanings

Operators | Meanings | Operators | Meanings |
---|---|---|---|

+ | Addition | >= | Greater than or equal to |

- | Subtraction | <> | Not equal to |

* | Multiplication | = | equal to |

/ | Division | & | String Concatenation |

\ | Integer Division | And | Logical And |

Mod | Modulo Division | Not | Logical Not |

< | Less than | Or | Logical Or |

> | Greater than | Xor | Logical Xor |

<= | Less than or equal to | ^ | Power |

## Assigning values to variables : '=' operator

The Assignment operator (=) is used to assign a value or an expression to a variable. When you assign a value, its not the same as the Equal to operation, but the value is copied to a variable. Besides assigning values and expressions, you can assign a variable to a variable also**Example:**

x=a+b

'=' , '+' are the operators.

x,a,b are the operands and 'a+b' is an expression. x=a+b is a statement.

The following program will print 20.

Private Sub cmdDisplay_Click()

Dim num As Integer, r As Integer, n As Integer

n = 10

r = n ^ 2 'n to the power 2

num = n + r / n

Print num

End Sub

Dim num As Integer, r As Integer, n As Integer

n = 10

r = n ^ 2 'n to the power 2

num = n + r / n

Print num

End Sub

Output: 20

## The Integer Division Operator ('\')

The Integer Division operator('\') eliminates the decimal part after division.

**Example:**

Private Sub cmdDivision_Click()

Dim a As Double, b As Double, c As Double

a = 12: b = 5

c = a \ b

Print c

End Sub

Dim a As Double, b As Double, c As Double

a = 12: b = 5

c = a \ b

Print c

End Sub

Output: 2

## The 'Mod' operator

The Mod operator is used to calculate remainder.

**Example:**

Private Sub cmdShow_Click()

Dim remainder As Integer, num As Integer

num = 21

remainder = num Mod 10

Print remainder

End Sub

Dim remainder As Integer, num As Integer

num = 21

remainder = num Mod 10

Print remainder

End Sub

Output: 1

## Boolean Operators : And, Or, Not, Xor

To learn about Boolean operators, you first need to have the concept of If-Else condition. So Boolean operators are explained in Lesson 18.