< Day Day Up > |

When the operators There are two additional logical operators: Short-circuiting is useful for two reasons. First, it can be used to produce more efficient code ”if the second part of a logical operation is expensive to evaluate, not evaluating it can save execution time. Also, short-circuiting can be used to simplify statements, yet avoid runtime errors. For example, compare the two ways of calculating the result in the following code. If x <> 0 Then If y \ x = 10 Then ... End If End If If x <> 0 AndAlso y \ x = 10 Then ... End If In the first case, two When applied to the integer values, the operators ## Figure 5-1. And Operation
The following are some examples of the result of the bitwise operators. Dim a, b, c, d As Integer a = Not 143 ' Result = -144 b = 312 And 43 ' Result = 40 c = 5823 Or 412 ' Result = 6079 d = 394 Xor 123 ' Result = 497 |

< Day Day Up > |

The Visual Basic .NET Programming Language

ISBN: 0321169514

EAN: 2147483647

EAN: 2147483647

Year: 2004

Pages: 173

Pages: 173

Authors: Paul Vick

Similar book on Amazon

flylib.com © 2008-2017.

If you may any questions please contact us: flylib@qtcs.net

If you may any questions please contact us: flylib@qtcs.net