Expressions And Operations; List Of Operator - Mitsubishi MELFA CR1D Instruction Manual

Table of Contents

Advertisement

4MELFA-BASIC V

4.1.6 Expressions and operations

The following table shows the operators that can be used, their meanings, and statement examples.

(1) List of operator

Operato
Class
r
Substituti
=
on
substituted in the left
side.
Numeric
+
Add
value
operation
-
Subtract
*
Multiply
/
Divide
^
Exponential operation M1=M1^2
\
Integer division
MOD
Remainder operation
-
Sign reversal
Comparis
=
Compare whether
on
equal
operation
<>
Compare whether not
or
equal
><
<
Compare whether
smaller
>
Compare whether
larger
=<
Compare whether
or
equal to or less than
<=
=>
Compare whether
or
equal to or more than
>=
4-113 MELFA-BASIC V functions
Meaning
Statement example
The right side is
P1=P2
P5=P_Curr
P10.Z=100.0
M1=1
STS$="OK"
P10=P1+P2
Mov P8+P9
M1=M1+1
STS$="ERR"+"001"
P10=P1-P2
Mov P8-P9
M1=M1-1
P1=P10*P3
M1=M1*5
P1=P10/P3
M1=M1/2
M1=M1\3
M1=M1 Mod 3
P1=-P1
M1=-M1
If M1=1 Then *L1
If STS$="OK" Then *L2
If M1<>2 Then *L3
If STS$<>"OK" Then *L4
If M1< 10 Then *L3
If Len(STS$)<3 Then *L4
If M1>9 Then *L3
If Len(STS$)>2 Then *L4
If M1<=10 Then *L3
If Len(STS$)<=5 Then *L4
If M1=>11 Then *L3
If Len(STS$)>=6 Then *L4
'Substitute P2 in position variable P1.
'Substitute the current coordinate value in current position variable P5.
'Set the position variable P10 Z coordinate value to 100.0.
'Substitute value 1 in numeric variable M1.
'Substitute the character string OK in the character string variable
STS$.
'GSubstitute the results obtained by adding the P1 and P2 coordinate
elements to position variable P10.
'Move to the position obtained by adding the position variable P8 and
P9 coordinate elements.
'Add 1 to the numeric variable M1.
'Add the character string 001 to the character string ERR and
substitute in character string variable STS$.
'Substitute the results obtained by subtracting the P2 coordinate
element from P1 in position variable P10.
' Move to the position obtained by subtracting the P9 coordinate
element from the position variable P8.
'Subtract 1 from the numeric variable M1.
'Substitute the relative conversion results from P10 to P3 in position
variable P1.
'Multiple the numeric variable M1 value by 5.
'Substitute the reverse relative conversion results from P10 to P3 in
position variable P1.
'Divide the numeric variable M1 value by 2.
'Square the numeric variable M1 value.
'Divide the numeric variable M1 value by 3 and make an integer
(round down).
'Divide the numeric variable M1 value by 3 and leave redundant.
'Reverse the sign for each coordinate element in position variable P1.
'Reverse the sign for the numeric variable M1 value.
'Branch to step *L1 if numeric variable M1 value is 1.
'Branch to step *L2 if character string in character string variable STS$ is
OK.
'Branch to step *L3 if numeric variable M1 value is 2.
'Branch to step *L4 if character string in character string variable STS$
is not OK.
'Branch to step *L3 if numeric variable M1 value is less than 10.
'Branch to step *L4 if No. of characters in character string STS$
variable is less than 3.
'Branch to step *L3 if numeric variable M1 value is more than 9.
'Branch to step *L4 if No. of characters in character string variable
STS$ is more than 2.
'Branch to step *L3 if numeric variable M1 value is equal to or less
than 10.
'Branch to step *L4 if No. of characters in character string variable
STS$ is equal to or less then 5.
'Branch to step *L3 if numeric variable M1 value is equal to or more
than 11.
'Branch to step *L4 if No. of characters in character string variable
STS$ is equal to or more than 6.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melfa cr2dMelfa cr3d

Table of Contents