4 Operators
4 Operators
Programming
2
Operators
Arithmetic Operators
OPERATOR MEANING
^ Used to raise a number to the power of
an exponent
* Used to multiply two numbers
/ Used to divide to numbers an return a
floating-point result
\ Used to divide to numbers an return an
integer result (Integer Division)
MOD Used to divide to numbers an return only the remainder
(Integer
Remainder)
+ Used to sum two numbers
- Used to find the difference between two numbers or to
indicate the
negative value of numeric expression
Relational Operators
• The execution of the block If is controlled by a
Boolean Expression.
OPERATOR SYMBOL
AND And
OR Or
NOT <>
Assignment Statements
• The simplest statement is the assignment statement.
It consists of a variable name (var), followed by the
assignment operator (=), followed by an expression
(expr).
Example:
StartTime = Now
Explorer.Caption = “Captain marvel”
count = count + 1
num = 5
count = count + num /2
Comment Statements
• An apostrophe (‘) can be used to indicate comments;
comments are ignored by Visual Basic.