Reference

VB Expression

An expression is a series of value elements combined with operators, which yields a new value (typically: Boolean, string, or a numeric type).
Value elements: e.g. variable, constant, literal, property, return from function.
Operator: element that performs an operation on value elements (there are five groups of operators in Visual Basic: arithmetic operators, comparison operators, concatenation operators, logical operators, bitwise operators).

    • arithmetic operators (e.g. +, -, *, ^) perform calculations on numeric values;
    • comparison operators (e.g. =, <, >=) compare two elements and return a Boolean value representing the result of the comparison;
    • concatenation operators (+, &) join multiple strings into a single string;
    • logical and bitwise operators (e.g. And, Or, Xor, Not) in Visual Basic combine Boolean or numeric values and return a result of the same data type as the values.

The value elements that are combined with an operator are called operands of that operator.

There is no practical limit to the number of operators that can be combined into an expression, but an understanding of operator precedence in Visual Basic is necessary to ensure that you get the results you expect.

There is also an assignment operator. The simplest assignment operator is “=”. This operator is used to assign the value on the right to the variable on the left. Assignment operator combined with value elements forms a statement (not an expression).