## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Introduction

Visual Basic is now completely on a par with C# and other languages in its scientific, engineering, and financial number-crunching capabilities. This chapter demonstrates how easy it is to develop very fast and powerful, yet easy-to-read code for advanced number-crunching applications. Some of the recipes will appeal to almost all developers, such as those demonstrating rounding, the new unsigned integers, and the new `Decimal` numbers that are suitable for the most demanding financial calculations. Other recipes will appeal to the many scientist and engineer types searching for 21st century updates for FORTRAN, programmable calculators, and Excel.

## 6.1. Using Compact Operator Notation

### Problem

You want to write compact, efficient code using the latest syntax available for assignment operators.

### Solution

Sample code folder: Chapter 06\CompactOperators

Visual Basic 2005 now lets you use the same compact assignment notation for some math operations that has been used in the C and C# languages for many years.

There are several compact assignment operators, and they all work the same way. The variable to the left of the operator is used both as a source value and as a destination for the results of the operation. The operators are listed in Table 6-1.

Table 6-1. Compact assignment operators
 Operator Description `^=` Exponentiation `*=` Multiplication `/=` Division `\=` Integer division `+=` Addition `-=` Subtraction `<<=` Shift left `>>=` Shift right `&=` Comparison

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required