Operators

Almost all programming languages use the same symbols for the most common operators. For example, + means addition, – means subtraction, and / means division.

A few differences, however, and different languages may also give slightly different precedence to the various operators. The following section explains how you can use parentheses to override the normal precedence and change the evaluation order. The sections after that summarize the most common operators used in C# and Visual Basic.

Parentheses

After you study the precedence tables that follow, you can come up with some interesting puzzles in figuring out how to evaluate expressions. For example, you can try to figure out the value of the following expression:

1 + 2 ^ 3 * 4 / 2

Get Start Here!™ Fundamentals of Microsoft® .NET Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.