Advertising banner:
 
 
 A312
 
81203_43854_21.png 81203_43840_19.png


Operator
Definition
Syntax
Example
&
Concatenates two strings (s1 and s2).
String concatenation adds the second string to the end of the first and returns this as a result string.
s1 & s2
Sub Main()
        Dim s1 as String, s2 as String, result as String
        s1 = "Hello" : s2 = "world"
        result = s1 & s2
                Print result    'result is assigned 'Hello world'
                Print result    'prints Hello world
End Sub
*
Multiplies two numbers (n1 and n2).
n1 * n2
n1 and n2 can be any valid numeric expression.
Sub Main()
        Print "10 times 4 is:", 10 * 4
End Sub
+
Adds two numbers (n1 and n2) or concatenates two strings (although we recommend & for concatenation).
n1 + n2
n1 and n2 can be any valid numeric expressions.
Sub Main()
        Print "The sum of 10 and 4 is:", 10 + 4
End Sub
-
Subtracts two numbers (n1 and n2) or negates the value of a number (n).
Subtraction
n1 - n2
n1 and n2 can be any valid numeric expressions.

Negation
-n
Subtraction
Sub Main()
        Print "10 minus 4 is:", 10 - 4
End Sub

Negation
Sub Main()
        Print "negated 99 is:", -99
        Print "negated -99 is:", -(-99)
End Sub
/
Divides two numbers (n1 and n2), when you want the result expressed as a floating point value.
n1 / n2
n1 and n2 can be any valid numeric expressions.
Sub Main()
        Print"10 divided by 4 is: ", 10/4               'prints 2.5
End Sub
\
Divides two numbers (n1 and n2).
The dividend will be truncated and the result will be expressed as an integer value without a remainder.
n1\n2
n1 and n2 can be any valid numeric expressions.
Sub Main()
        Print "10 divided by 4 is:", 10\4       'prints 2
End Sub
< (less than)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is less than e2, TRUE is returned; otherwise, FALSE is returned.
e1 < e2
If num < 5 Then
        Print "The value of 'num' is less than 5"
<= (less than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is less than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
e1 <= e2
If num <= 5 Then
        Print "The value of 'num' is less than or equal to 5"
<> (not equal)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If the values are different, TRUE is returned; otherwise, FALSE is returned.
e1 <> e2
Sub Main()
        Dim num as Integer
        num = 5
        If num <> 5 Then
                Print "The value of 'num' is not equal to 5"
Else
        Print "The value of 'num' is equal to 5"
        End If
End Sub
=
Compares the values of two expressions (e1 and e2) of the same or similar types.
If the values are the same, TRUE is returned; otherwise, FALSE is returned.
e1 = e2
Sub Main()
        Dim num as Integer
        num = 5
If num = 5 Then
        Print "The value of 'num' is equal to 5"
> (greater than)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is greater than e2, TRUE is returned; otherwise, FALSE is returned.
e1 > e2
Sub Main()
        Dim num as Integer
        num = 5
        If num > 5 Then
                Print "The value of 'num' is greater than 5"
        Else
                Print "The value of 'num' is less than or equal to 5"
        End If
End Sub
>= (greater than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is greater than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
e1>= e2
If num >= 5 Then
        Print "The value of 'num' is greater than or equal to 5"
AND
Evaluates whether two expressions (e1 and e2) are TRUE.
Both expressions must be TRUE for the AND result to be TRUE.
e1 AND e2
Sub Main()
Dim e1 as Integer, e2 as Integer e1 = TRUE: e2 = 5< 34
        If e1 AND e2 Then
                 Print "Both expressions are TRUE"
        Else
                Print "Neither expression is TRUE"
        End If
End Sub
MOD
Returns the remainder from the division of two numbers (n1 and n2), expressed as an integer.
n1 MOD n2
n1 and n2 can be any valid numeric expressions.
Sub Main()
        Print "The remainder from 10 divided by 4 is:", 10 MOD 4                'prints 2
End Sub
NOT
Evaluates whether an expression (e) is FALSE.
NOT e
Sub Main()
        Dim e1 as Integer
        e1 = TRUE
        If NOT e Then
                Print "Expression 'e' was FALSE"        
                'NOT TRUE=FALSE
        Else
                Print "Expression 'e' was TRUE"
        End If
End Sub
OR
Evaluates whether one or both of two expressions (e1 and e2) are TRUE.
Only one of the expressions needs to be TRUE for the OR result to be TRUE.
e1 OR e2
Sub Main()
        Dim e1 as Integer, e2 as Integer
e1 = TRUE : e2 = 5 < 34
        If e1 OR e2 Then
Print "Either one or both expressions are TRUE"
        Else
        Print "Both e1 and e2 do not evaluate to TRUE"
        End If
End Sub
XOR
Evaluates whether only one of two expressions (e1 and e2) is TRUE.
One expression must be TRUE and the other must be FALSE for the XOR result to be TRUE.
e1 XOR e2
Sub Main()
        Dim e1 as Integer, e2 as Integer
        e1 = TRUE: e2 = 5 < 34
If e1 XOR e2 Then
                Print "Only one expression, e1 or e2, is TRUE"
        Else
                Print "Both e1 and e2 are TRUE or Both e1 and e2 are FALSE"
        End If
End Sub
^
Raises a number (n1) to the power of a second number (n2).
For example, raising a number to the power of 2 gives the square of the number.
n1^n2
Sub Main()
        Print "10 squared is:", 10^2
        Print "4 cubed is:", 4^3
         Print "6.4 to the power of 1.5 is ", 6.4^1.5
End Sub


hirosue Shino Web Site