Library tutorials & articles
Mathematical Functions
Standard Math Functions
| Math Function | Evaluates: |
|
|
Less than? |
|
<> |
Not |
|
> |
Greater than? |
|
+ |
Add |
|
* |
Multiply |
|
() |
Math Brackets |
|
- |
Subtract |
|
^ |
Power of |
| / | Divide |
You can use these as if you were using a calculator. The standard rule applies that division and multiplication are calculated before addition and subtraction, unless you use brackets. For example,
3 + 2 * 5 = 13 ' 2 multiplied by 5 is 10, then, add 3 which
gives us 13
(3 + 2) * 5 = 25 ' 3 and 2 equals 5, and then multiply the 5 by 5, which gives
us 25
The noticeable differences between a calculator and Visual Basic is that the signs used are slightly different. Look at the table below to see what I mean.
For example, the following code performs a number of functions on a number, and displays a message box with the result
' Multiply
Msgbox "Multiply 1 * 32: " & 1 * 32
' Divide
Msgbox "Divide 32 / 12: " & 32 / 12
' Power of 3
Msgbox "Power 9 ^ 3: " & 9 ^ 3
' Greater than 100?
Msgbox "234 greater than 100? " & 234 > 100
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Comments
Leave a comment
Sign in or Join us (it's free).