ooPIC Logo

Arithmetic Operators

Main Index
Language Idx
Back to top of pageDescription:
 An Operator that performs an Arithmetic conjunction on the surrounding expressions.
Back to top of pageSyntax:
 The following shows the format of the Arithmetic Operator syntax.
 Visual Basic & BASICC & Java
Addition
<exp1> + <exp2>
<exp1> + <exp2>;
Subtraction
<exp1> - <exp2>
<exp1> - <exp2>;
Multiplication
<exp1> * <exp2>
<exp1> * <exp2>;
Division
<exp1> / <exp2>
<exp1> / <exp2>;
Modulus
<exp1> Mod <exp2>
<exp1> % <exp2>;
Max
<exp1> Max <exp2>
<exp1> Max <exp2>;
Min
<exp1> Min <exp2>
<exp1> Min <exp2>;
 

The following table lists the elements of the Arithmetic Operator syntax.
ElementDescription
<exp1>Any valid expression.
<exp2>Any valid expression.

Back to top of pageOperation:
 Addition  adds one number to another.

Subtraction subtracts one number from another.

Multiplications multiplies one number with another.

Division divides one number by another.

Modulus divides one number by another and returns the remainder.

Max takes the maximum of the two.

Min takes the minimum of the two.

Back to top of pageRemarks:
 

Arithmetic Operator can also be done with the oMath Object.

Back to top of pageExample:
 In the following example demonstrates the use of arithmetic operators.
Visual BasicC & Java
Dim A As Word
Dim B As Byte
Dim C As Byte
Dim D As Byte

Sub Main()
  A = B + C * B / D
  A = B Mod C  
  A = B Max C  
  A = B Min C  
End Sub
Word A; 
Byte B; 
Byte C; 
Byte D; 

Void Main(Void){
  A = B + C * B / D;
  A = B Mod C;  
  A = B Max C;
  A = B Min C;  
}
BASIC 
A As Word
B As Byte
C As Byte
D As Byte

A = B + C * B / D
A = B Mod C  
A = B Max C  
A = B Min C  
 

Back to top of pageRelated Items:

 Bitwise and Logical Operators

Relational Operators

Back to top of pageVersion History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.