Operator Usage
What Is Operator?
OPERATOR in the programming language could be interpreted as a symbol that is used to perform an operation on data values. Operator symbol can be a character or a special word.
Visual Basic 6 recognize three types of operators, namely:
OPERATOR in the programming language could be interpreted as a symbol that is used to perform an operation on data values. Operator symbol can be a character or a special word.
Visual Basic 6 recognize three types of operators, namely:
* Arithmetic Operators are used for mathematical operations on data values.
These symbols are used:
Symbol Mathematical Operators Examples
^ Reappointment 5 ^ 2 result 25
* multiplication result 10 5 * 2
/ Division (the breakdown products) 5 / 2 result 2.5
\ Division (the round) 5 \ 2 result 2
Mod Time Division 5 Mod 2 results 1
+ The sum 5+2 result 7
- Reduction 5-2 results 3
& String concatenation 5 & 2 result 52
* Comparison operator used to compare the operating data values.
These symbols are used:
Symbol Comparison Operations Examples
< Smaller 5 <2 the result FALSE
> More large 5> 2 results TRUE
<= Less than or equal to 5 <= 2 the result FALSE
> = Was greater or equal to 5> = result TRUE
= Same with 5 = 2 the result FALSE
<> Not equal to 5 <> 2 result TRUE
* Logical operators are used to compare the operation of a comparison.
These symbols are used:
Symbol Logic Operators Examples
Or Or (5<2) O(5>2) resul TRUE
And And (5<2) And (5>2) the result FALSE
Not Not Not (5<2) result is TRUE
XorOr exlusive
Eqv Equivalent
Imp Implication
Use of Function
The function is a procedure that can receive various value for laterprocessed and results as bait baliknya.Nilai entered intoin a function called parameters, which can form various types of numbers,string, and so forth. Consisting of:
a. String FunctionsAllows you to manipulate string data, for example:
1. '& Useful to combine a string value, for example:
"Home" & "Sick" produce "Hospital"
2. · Asc () Allows you to change the value of the string into an ASCII value,
Examples: Asc ("A") to produce 65
3. · Chr () is useful to convert an ASCII value into a String value,
Examples: Chr (65) menghasilkanA
4. · Left () is useful to take n characters to the left of the string
Example: Left ("Computer", 2) produce "Ko"
5. · Right () is useful to take n characters to the right string
Example: Right ("Computer", 2) generate "er"
6. · Mid () is useful to take n character string from a position
Defined. Example: Mid ("Computer", 2, 3) generate "Ompu"
7. · Len () is useful to get the number of characters that form the string
Example: Len ("Computer") produced 8
8. · Str () Allows you to change the numerical values into string values
Examples: Str (2 3) produce a "5"
9. · Val () is useful to change the string value into a numeric value
Example: Val ("5") yields 5
10. · Ucase Useful convert string values to uppercase
Example: Ucase ("Hospital") to "HOSPITALS '
11. · Lcase Useful to change the value of the string to lowercase
Example: Lcase ("Hospital") to "hospital"
b. Mathematical FunctionsUseful to perform specific calculations or manipulations ofnumerical data, for example:
1. · Abs () is useful to produce an absolute value, for example: Abs (-30) = 30
2. · Atn () Generates the arc tangent in radians,
For example: Atn (3.14) = 1.2626
3. · Cos () Generates the cosine in radians, for example: Cos (3.14) = -1
4. · Sin () Generate the sine in radians
5. · Tan () Generates the value of the tangent in radians
6. · Mod () Generate the residual value of the division, for example: 8 mod 3 = 2
7. · Sqr () Generates the value of the root number, example: Sqr (16) = 4
8. · Round () rounded decimal integers in a certain amount,
Example: Round (33.3457, 2) = 33.34
9. · Hex () Generate hexadecimal value of a number
Example: Hex (459) = 1CB
10. · Oct () Generate octal value of a number
Example: Oct (8) = 10
c. Date and Time FunctionsSome functions that are intended only for the variable type Date is:
1. · Now Generate date and hour of computer systems.
2. · Date Generates date computer system, for example: Date
generate the current date, eg 17.01.2005
3. · Day () Generates figures date from the date,
For example: Day (Date) = 13
4. · Month () Generates digit months of the date,
For example: Month (Date) = 1
5. · Year () Produce the number of years from the date,
For example: Year (# 17/01/2005 #) = 2005
6. · Time Generates clock computer system, for example: Time
resulted 11:30:56
· Hour () Generates clock rate, for example: Hour (# 11:30:56 #) = 8
· Minute () Produces the number of minutes, for example: Minute (Time) = 30
· Second () Generate a number of seconds, for example: Second (Time) = 56