Until this point, we have covered the arithmetic, relational, and logical operators that Visual Basic .NET makes available. In complex expressions, you might use all three operators in a single program statement. How does Visual Basic .NET decide how to process each expression in such complex statements? Once again, operator precedence determines the sequence that Visual Basic .NET will follow. Table 10.6 presents the order for all of Visual Basic .NET's operators, starting with the highest precedence and working down to the lowest precedence. (Note that Table 10.6 includes a few operators that are covered in later chapters.) Table 10.6. Visual Basic .NET Operator Precedence
As a general rule, the arithmetic operators have highest precedence, followed by the relational operators, followed by the logical operators. You might want to dog-ear this page because you will probably need to refer to this table later on, when the program examples become a little more complex. You should keep in mind that you can override the operator precedence by using parentheses to force the order in which expressions are evaluated (refer to Chapter 9). |