Mathematical Operators: ( +, -, *, /, ^, mod or %, >, <, <> or != ):

All mathematical expressions should be enclosed in parentheses when you are uncertain about how the precedence of calculations will be applied.

 

Operator Symbol:

Description:

+

Sums two variables.
result = ( expression1 + expression2 )

-

Finds the difference between two numbers.
result = ( expression1 - expression2 )

*

Multiplies two numbers.

result = ( expression1 * expression2 )

/

Divides two numbers.
result = ( expression1 / expression2 )

^

Raises expression1 to the power of an expression2. The result is always floating.

result = ( expression1 ^  expression2 )

MOD

or

%

MOD and % are modulus, or remainder operators. Result returned is a remainder value between 0 and the Absolute(value) of the number being divided.  Sign of the resulting value is the same as the sign of the number being divided.

 

The arguments to the modulus operator may be floating-point numbers, so that 5.6 % 0.5 returns 0.1.  Both operators will return the same result.  Value returned by each is the remainder from the division. The left and right expressions can be floating or integer. The results will be float or int depending on the values used.

 

Examples:

test.currentDate = ,2015-01-01,
 
DateToJulian(test.currentDate) ,42004,
iJulianDate % 7 = ,4,
42004 % 7 = ,4,
 
DayOfWeek(test.currentDate) = ,4,
DateToJulian(test.currentDate) MOD 7 = ,4,
iJulianDate MOD 7 = ,4,

>

Greater than symbol used in a conditional reference test where a True or a False is needed.

1 > 2 = True,  2 > 1 = False

<

Less than symbol used in a conditional reference test where a True or a False is needed.

1 < 2 = True,  2 < 1 = False

<> or !=

Both symbol pairs are used when the values on either side are Not True.

1 <> 2 = True,  2 <> 2 = False, 4 != 3 = True

 

 

Logical Operators ( AND NOT OR ):

Operator Names:

Description:

AND

Performs compound result of TRUE, if, and only if, all of its components are true.  Result is always an Integer value.

 
'  Expression result will return either a TRUE or a FALSE value.
(expression1 AND expression2) = [TRUE or FALSE Based on how variables compare]

 

TRUE will be returned when each variables are the same value
 

FALSE will be returned when each value are NOT the same.

NOT

Performs logical negation of an expression.  Result is always an Integer value.

 

Applying this operator to a variable will always returns a negated Integer value.

'  Example: If Value is equal to 1, return will be:
PRINT value
value = 1
 
'  Example: If Value is equal to 1, return will be:
PRINT NOT value
NOT value = 0

OR

Performs a logical disjunction on two expressions.  Result is always an Integer value.

 
'  Expression result will return either a TRUE or a FALSE value.
(expression1 OR expression2) = [TRUE or FALSE Based on how variable compare]

 

TRUE will be returned when either variables is TRUE.
 

FALSE will be returned when both values are FALSE.

 

Example - 0:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  These operators can be enclosed in parentheses like a
'  mathematical expression to force evaluation in a certain order.
If ( ( a = 1 ) AND ( b > 5 ) ) OR ( ( a = 2 ) AND ( b < 6 ) AND ( NOT c ) ) THEN
  '  Do something
  PRINT "It is TRUE, Do something"
Else
  '  Do something else
  PRINT "It is FALSE, Do something else"
EndIf
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Example - 1:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

If NOT condition1 THEN
  PRINT "condition1 = FALSE", condition1
ELSE
  PRINT "condition1 = TRUE", condition1
ENDIF

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

Returns - 1:

condition1 = TRUE 1

Example - 2:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
condition2 = FALSE
If NOT condition2 THEN
  PRINT "condition2 = FALSE", condition2
ELSE
  PRINT "condition2 = TRUE", condition2
ENDIF  

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Returns - 2:

condition2 = FALSE 0

 

Links:

Constants Reference, Data Groups and Types

See Also:

 

 


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 446

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software