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 - 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 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
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Explore the arithmetic operators3m 24s
-
(Locked)
Explore the comparison and logical operators5m 56s
-
(Locked)
If and Else5m 16s
-
(Locked)
Use the And, Or logical operators3m 13s
-
(Locked)
Use AndAlso, OrElse for better performance2m 48s
-
(Locked)
Select Case3m 30s
-
(Locked)
Challenge: Logic statements and string compare1m 50s
-
(Locked)
Solution: Logic statements and string compare3m 16s
-
(Locked)
-
-
-
-