| COMPUTE | |||||||||||||||||||
| Syntax | COMPUTE [name operator operand] |
||||||||||||||||||
| Explanation | The COMPUTE command is intended for
working with variables inside the RCX robot controller.
COMPUTE performs an arithmetic or boolean operation on a
Logo name and an operand and stores the result into the
Logo name. It is equivalent to the Logo command MAKE
:name :name operator operand. The input to this command is a three-element list. The
first element is the name of the variable which is to be
altered. The second input is the operator. The third
input depends on the operation. The following operators
and operands are defined:
RCX variables are signed integer variables with a
value range from 32768 to 32767. Overflows are not
handled, so if a multiplication overflows this range, the
result may be unexpected. If this command is used with
normal Logo variables, there is no range limitiation. The
special values for assignments are not available,
however. It is only possible to assign other variables or
numbers. Use the RCX.PANEL command
to display the RCX panel which displays the contents of
all variables, sensors, and timers. |
||||||||||||||||||
| Examples | RCX.NAMES [A B C] COMPUTE [A = ?10]:A Result: 3 COMPUTE [A + 5]:A Result: 8 |
||||||||||||||||||