From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Explore the arithmetic operators

Explore the arithmetic operators - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Explore the arithmetic operators

- [Instructor] Look at this code. Is it clear what will happen? I think so. There are three variables. Calling the add function adds A to B and assigns the results to the total variable. We can also add A and B together using the plus operator. An operator is essentially a function, but it is written in a more concise and readable way. This achieves the same result with less code while still being easy to understand. The plus operator is expressed with the plus symbol, which makes it look more like a math formula. In addition, the VP compiler understands how to parse and interpret the expression. Notice how the operator sits between the two operands. There is no parentheses and no need for commas. Using operators makes it easier to string together readable expressions. This expression looks like standard math. This is what that simple expression would look like if written as traditional functions. Which do you think is more readable? To repeat, these operators are implemented as code,…

Contents