Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms


.

Home to new Visual Basic .NET programmers

Operators

 

Home ] What is this site? ] myExercises ] myTutorials ] myExam ] myMicrosoft ] myNotes ] Study Advice ] myLinks ]


Search (my)Visual Basic .NET

(Tip: Scroll past sponsored links to see your search results for this website)


Complain to Volkswagen South Africa (VWSA)


New to myExercises:

 

Lynnwood Consultants Program
Computer Calculator Program
Funny Time Program
Creative Minds Login Program
Hatfield Pizza & Pasta Program
  Shutterbug Program

New to myNotes:

 

>>

TOE chart


Order this book today from

kalahari.net: click-click, ding-dong

 

Title: Microsoft Visual Basic 2005:

         RELOADED, Second Edition

Author:  Diane Zak

 

Click the image below to order your copy.

 

Up ] GUI Standards ] Access Files ] Accumulators, Counters & Averages ] Arrays ] Collections ] Constants & Enumerators ] Crystal Reports ] Data Types ] Flowchart Symbols ] Functions ] Keywords ] Methods ] Operators ] Repetition Structures ] Selection Structures ] Sub Procedures ] Toolbox Controls ] Variables ] Windows Forms ]


 

intro

Types

    Comparison Operators

    Logical Operators

    Mathematical operators

purpose

truth table (precedence)

 


 

Comparison operators

 

Is

TypeOf...Is

Like

 

 

Mathematical operators

 

You instruct the computer to perform a calculation by writing an arithmetic expression that contains one or more arithmetic operators.

 

Precedence 

Order

Mathematical 

Operator

Name

Description

1 ^ Exponentiation  Raises a number to a power, e.g 5^3 means 5 * 5 * 5
2 - Negation Is used to indicate a negative number, e.g -5
3 * ,  / Multiplication and Division The Division operator is used to divide whole or decimal numbers and give a whole or decimal number answer
4 \ Integer Division Is used to divide whole numbers and get a whole number answer (no decimals)
5 Mod Modulus Arithmetic

Is used for division, but it returns the remainder of the division.  Standard division and integer division tells you how many times a number will fit into another number, e.g.

2004 / 4 = 501

2004 Mod 4 = 0

6 +  ,  - Addition and Subtraction  

 

Tips:

 

* Calculations are performed in the order specified by the operator's precedence, however
* you can use parentheses ( ) to override the order of precedence
* Operators that share precedence will be dealt with from left to right
* The integer division operator is used to divide whole numbers and get a whole number answer
* The division operator is used to divide whole or decimal numbers and get a decimal number answer
* The modulus (Mod) operator is used for division, but returns the remainder of the division, whereas standard division and integer division tells you how many times a number will fit into another number.
* The modulus operator is useful to calculate leap years.

 

Examples:

 

Calculations are performed in the order that is specified by the operator's precedence, e.g. 5 - 2 * 7 + 2 will be calculated as:

 

2 * 7 = 14

14 - 5 = 11

11 + 2 = 13

 

 

Operators that share precedence will be calculated from left to right:

 

5 + 3 - 7 + 2 - 3

-------------------->

 

 

You can override precedence by using parentheses.  Whatever lies within the parentheses will be calculated first, e.g 

(5 - 2) * (7 + 2):

 

5 - 2 = 3

7 + 2 = 9

3 * 9 = 27

 

 

How to remember the difference between the division operator ( / ) and the integer division operator ( \ ):

 

Let's use the value 123.45

 

                                 /        The division operator leans over toward the decimals, which mean that decimals are included

                                 \        The integer division operator leans toward the whole numbers, meaning that decimals are exluded

 


All content on this site is free for private use only  |  Contributions are encouraged  |  Thank you to Netfirms for the free hosting  |  If copyright content is published here or links to certain content violates some right/law, contact the Webmaster to have it removed immediately.

 

Site launched: October 2005  |  Updated: July 20, 2006  |  Link exchange  |  Site map  |  Contact us