From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Explore the arithmetic operators

Explore the arithmetic operators - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Explore the arithmetic operators

- [Instructor] Look at this code. Is it clear what will happen when it runs? I think so. There are three variables, calling the add function adds a to b and assigns the result to the total variable. We can add a and b together in another way with the plus operator. An operator is a function that is called in a more readable fashion. The operator is expressed with the plus symbol which makes it look more like a math formula. Plus the VB compiler knows how to parse the expression. Notice how the operator sits between the two operands, a and b. There's no parentheses and no need for commas. Using operators makes it easier to string together readable expressions. This looks like standard math. This is what that simple expression would look like if it was written as traditional functions. Which do you think is more readable? To repeat, these operators are implemented as code but developers can use them with a simpler…

Contents