Visual Basic .NET/Operators

From Wikibooks, open books for an open world
Jump to: navigation, search

Operators[edit]

Programming languages have a set of operators that perform arithmetical operations, and others such as Boolean operations on truth values, and string operators manipulating strings of text. Computers are mathematical devices, but compilers and interpreters require a full syntactic theory of all operations in order to parse formulae involving any combinations correctly. In particular they depend on operator precedence rules, on order of operations, that are tacitly assumed in mathematical writing.

Conventionally, the computing usage of operator also goes beyond the mathematical usage (for functions). In Visual Basic.NET, New, AddressOf and CType are operators. You can also define your own uses for operators. When an operator is alphanumeric rather than a punctuation character, it is sometimes called a named operator.

So operators are special symbols that are used to represent for example simple computations like addition and multiplication. Most of the operators in VB.NET do exactly what you would expect them to do, because they are common mathematical symbols. For example, the operator for adding two integers is +.