### Logo Commands

#### The Workspace

#### Working with Data

Put data together

Access data

Test data or data contents

Create and manipulate arrays

Read, write, and print data

Working with Properties

Multimedia commands

Put data together

Access data

Test data or data contents

Create and manipulate arrays

Read, write, and print data

Working with Properties

Multimedia commands

Arithmetic computations.

Logo understands quite a lot of math commands, from simple addition and subtraction up to functions like the cosecant, or the square root. Random numbers are part of the math functions as well.

Raises a number to the power of another number.

number ^ number POWER number number (POWER number number number ...)

POWER raises the first number to the power of the second number.
Its abbreviation is ^. When given multiple inputs, POWER and all its inputs
must be enclosed in parentheses. The ^ symbol for POWER may be used as either
a prefix or infix operator. See also `EXPN`

.

Outputs the difference of two or more numbers.

number1 - number2 DIFFERENCE number1 number2 (DIFFERENCE number1 number2 number3 ...)

DIFFERENCE reports the result of subtracting its inputs. DIFFERENCE expects two inputs, but will accept more if it and its inputs are enclosed within parentheses. DIFFERENCE is equivalent to the prefix or infix operator -.

Reports the sum of its inputs.

number1 + number2 SUM number1 number2 (SUM number1 number2 number3 ...)

SUM reports the result of adding its inputs. SUM expects two inputs, but will accept more if it and its inputs are enclosed within parentheses. SUM is equivalent to the infix operator +.

Calculates the product of its inputs.

number * number PRODUCT number number (PRODUCT number number number)

PRODUCT multiplies its inputs and reports the result. PRODUCT expects two inputs, but will accept more if it and all its inputs are enclosed in parentheses. PRODUCT is equivalent to *. When used as the * symbol, PRODUCT may be a prefix or an infix operator.

PRODUCT 2 3Result: 6PRODUCT 4 -1.2Result: -4.8PRODUCT -.5 -1.5Result: 0.75(PRODUCT 2 3 4 5)Result: 120

Reports the quotient of its inputs.

number / number QUOTIENT number number (QUOTIENT number number number ...)

QUOTIENT reports the result of dividing the first input by the second input.
QUOTIENT expects two inputs, but will accept more if it and all its inputs
are enclosed in parentheses. The symbol “/” can be used as a prefix
or an infix operator. See also `%`

and `MODULO`

.

Outputs the remainder of two numbers.

dividend % divisor REMAINDER dividend divisor

REMAINDER reports the number that is the remainder of dividing
the first input by the second. The symbol “%” can be used as a prefix
or an infix operator. See also `/`

.

REMAINDER reports the result of `(dividend - (divisor * int(dividend /divisor)))`

.
The result is the same as for `MODULO`

if the signs of both operand are
the same, but are different from `MODULO`

when the signs are different.

Until Logo version 4.0.4, REMAINDER was an alias for `MODULO`

.

Tests its inputs for equality.

object = object = object object

The equality operator compares two objects. If they are equal, the output is
TRUE; otherwise it is FALSE. This operator is the same as the
`=`

command. The operator “=” may be used either as a prefix or as an infix operator.

The value of the `:EPSILON`

variable determines how the equality operator compares
two numbers. See `:EPSILON`

for details.

4 = 5Result: FALSE= 4 5Result: FALSE.EQ 5 5Result: TRUEEQUAL? [6] [6]Result: TRUEEQUAL? 6 [6]Result: FALSE

Tests its inputs for inequality.

object != object object <> object NOTEQUAL? object object

NOTEQUAL? reports TRUE if its two inputs are not equal; otherwise it reports FALSE. Its inputs may be numbers, words, or lists. The symbols != and <> are abbreviations for NOTEQUAL?. The symbols “<>” and “!=” may be used as infix or prefix operators.

The value of the `:EPSILON`

variable determines how the inequality operator compares
two numbers. See `:EPSILON`

for details.

NOTEQUAL? 6 6Result: TRUENOTEQUAL? 6 66Result: TRUENOTEQUAL? "AZURE "AZUREResult: FALSENOTEQUAL? [SPRING GREEN] [SPRING GREEN]Result: FALSENOTEQUAL? "AZURE [AZURE]Result: TRUE

Tests if its first input is less than its second input.

number < number .LT number number

The Less Than operator compares two numbers. If the first number is less than the second number, the output is TRUE; otherwise it is FALSE. The symbol “<” may be used either as a prefix or as an infix operator.

Tests if its first input is greater than its second input.

number > number .GT number number

The Greater Than operator compares two numbers. If the first number is greater than the second number, the output is TRUE; otherwise it is FALSE. The symbol “>” may be used either as a prefix or as an infix operator.

Tests if its first input is greater than or equal to its second input.

number >= number .GE number number

The Greater Than or Equal operator compares two numbers. If the first number is greater than or equal to the second number, the output is TRUE; otherwise, it is FALSE. The symbol “>=” may be used either as a prefix or as an infix operator.

Tests if its first input is less than or equal to its second input.

number <= number .LE number number

The Less Than or Equal operator compares two numbers. If the first number is less than or equal to the second number, the output is TRUE; otherwise it is FALSE. The symbol “⇐” may be used either as a prefix or as an infix operator.

Reports the absolute value of a number.

ABS number

ABS reports the absolute value of its input.

Logical AND.

AND input1 input2 (AND input1 input2 input3 ...)

AND accepts two or more inputs, which must be either TRUE or FALSE. AND reports
TRUE if all of its inputs are true; otherwise it reports FALSE. By default, AND
expects two inputs. If more inputs are supplied, both AND and its inputs must be enclosed in
parentheses. See also `OR`

.

Reports the arccosine.

ARCCOS number

ARCCOS takes as input a number between -1 and 1 and reports its arccosine, a value between 0 and 180.

Reports the arccotangent.

ARCCOT number

ARCCOT reports the arccotangent of its input.

Reports the arccosecant.

ARCCSC number

ARCCSC reports the arccosecant of its input.

Reports the arcsecant.

ARCSEC number

ARCSEC reports the arcsecant of its input.

Reports the arcsine.

ARCSIN number

ARCSIN takes as input a number between -1 and 1 and reports its arcsine, a value between -90 and 90.

Reports the arctangent.

ARCTAN number

ARCTAN reports the arc tangent of its input as degrees.

Reports the polar angle heading of the motion vector (position change) deltaX deltaY.

ARCTAN2 deltaX deltaY

ARCTAN2 reports the full-circle polar angle (in degrees) of its input motion vector deltaX deltaY. Output 0 represents the positive x-axis direction (3 o'clock). Polar angles increase going counter clockwise.

See also `PANGLE`

, `PSETHEADING`

and `PHEADING`

.

Reports the cosine.

COS number

COS reports the cosine of its input, a number of degrees. Remember that COS x = adjacent / hypotenuse.
See also `ARCTAN`

and `SIN`

.

Reports the cotangent.

COT number

COT reports the cotangent of its input.

Reports the cosecant.

CSC number

CSC reports the cosecant of its input.

Calculates the natural base e raised to a power.

EXPN number

EXPN calculates the natural base e (2.7183. . .) raised to the power
specified by its input. See also `^`

.

Reports the integer part of a number.

INT number

INT reports the integer portion of its input by removing the decimal portion, if any.
No rounding occurs. See also `ROUND`

.

Outputs the natural logarithm of its input.

LOG number

LOG reports the natural logarithm of its input. See also `LOG10`

.

Outputs the logarithm of its input.

LOG10 number

LOG10 reports the base 10 logarithm of its input. See also `LOG`

.

Combines its inputs with a boolean AND operation.

LOGAND integer1 integer2

LOGAND reports the bitwise logical AND of its two inputs. Each input is expressed internally as a 32 digit binary number. A logical AND operation is performed on the pair of binary digits (bits) in each position, resulting in a 32 bit integer. The logical AND operation is defined on the binary digits 0 and 1 as follows:

`LOGAND 0 0 = 0`

`LOGAND 1 0 = 0`

`LOGAND 0 1 = 0`

`LOGAND 1 1 = 1`

Reports the bitwise logical complement of its input.

LOGNOT integer

LOGNOT reports the bitwise logical complement of its input, replacing all 1's
with 0's and all 0's with 1's. Since integers are stored in the computer as
base 2 numbers 32 digits long, all the leading 0's turn into 1's.
See also `LOGAND`

, `LOGOR`

, and `LOGXOR`

.

Combines its inputs with a boolean OR operation.

LOGOR integer1 integer2

LOGOR reports the bitwise logical OR of its two inputs. Each input is expressed internally as a 32 digit binary number. A logical OR operation is performed on the pair of binary digits (bits) in each position, resulting in a 32 bit integer. The logical OR operation is defined on the binary digits 0 and 1 as follows:

`LOGOR 0 0 = 0`

`LOGOR 1 0 = 1`

`LOGOR 0 1 = 1`

`LOGOR 1 1 = 1`

Combines its inputs with a boolean XOR operation.

LOGXOR integer1 integer2

LOGXOR reports the bitwise logical XOR of its two inputs. Each input is expressed internally as a 32 digit binary number. A logical XOR operation is performed on the pair of binary digits (bits) in each position, resulting in a 32 bit integer. The logical XOR operation is defined on the binary digits 0 and 1 as follows:

`LOGXOR 0 0 = 0`

`LOGXOR 1 0 = 1`

`LOGXOR 0 1 = 1`

`LOGXOR 1 1 = 0`

Shifts its input with sign extension.

LSH integer integer

LSH reports the first input logically shifted the number of bit positions
specified by the second input. If the second input is positive, the logical
shift is to the left. If the second input is negative, the logical shift is to the right, with the extension of the sign bit. This is the difference to `LSHIFT`

.

Shifts its input without sign extension.

LSHIFT integer integer

LSHIFT reports the first input logically shifted the number of bit positions
specified by the second input. If the second input is positive, the logical
shift is to the left. If the second input is negative, the logical shift is to the right, filling up the field with zero bits. This is the difference to `LSH`

.

See also `LSH`

.

Outputs the negative value of its input.

MINUS number

MINUS reports the result of subtracting its input from 0. Note that MINUS binds less than other operators. Thus, MINUS 3 + 4 is -7 (-(3+4)) and not 1 (-3+4).

Outputs the remainder of two numbers.

MODULO dividend divisor

MODULO reports the number that is the remainder of dividing
the first input by the second. See also `%`

and `/`

.

MODULO reports the result of `(dividend - (divisor * floor(dividend / divisor)))`

.
The result is the same as for `%`

if the signs of both operand are
the same, but are different from `%`

when the signs are different.

Negates its input.

NOT expression

NOT reports TRUE if its input is false; otherwise it reports FALSE.

NOT "FALSEResult: TRUENOT "TRUEResult: FALSENOT NUMBER? "AResult: TRUEIF NOT (2 > 3) THEN PRINT "YESYES

Performs a logical OR on its input.

OR object1 object2 (OR object1 object2 object3 ...)

OR reports FALSE if all of its inputs are false; otherwise, it reports TRUE. OR accepts two or more inputs, which must be either TRUE or FALSE.

OR "TRUE "TRUEResult: TRUEOR "TRUE "FALSEResult: TRUE(OR "FALSE "TRUE "FALSE)Result: TRUEIF OR (2 = 3) (3 = 3) [PRINT "YES]YES

Reports the number Pi.

PI

PI reports the value of pi. The number of digits displayed for PI is determined
by the current value of `:PRECISION`

. The full value of PI is always used in
calculations, regardless of the value of `:PRECISION`

.

Reports the arc tangent of an angle expressed in radians.

RADARCTAN number

RADARCTAN reports the arc tangent of its input as radians.
If RADARCTAN has two inputs x and y, it uses y/x if x is nonzero; if x is zero,
it outputs PI/2 if y is positive, or -PI/2 if y is negative. To compute the value of
pi, use 2*(RADARCTAN 0 1), or use `PI`

.

Reports the cosine of an angle expressed in radians.

RADCOS number

RADCOS reports the cosine of its input as radians. Remember that RADCOS x = adjacent / hypotenuse.
See also `RADARCTAN`

and `RADSIN`

.

Reports the sine of an angle expressed in radians.

RADSIN number

RADSIN reports the sine of its input, which is the number of radians in an angle.
Remember that SIN x = opposite/hypotenuse. See also `RADARCTAN`

and `RADCOS`

.

Outputs a random number.

RANDOM number (RANDOM bottom top)

RANDOM reports a randomly selected number from 1 through its input. The output can only be a positive integer. For example: RANDOM 5 could report 1, 2, 3, 4, or 5. If RANDOM has two inputs, RANDOM outputs a random number between, and including, these two numbers. RANDOM delivers cryptographically secure numbers.

Seed the random number generator.

RERANDOM number (RERANDOM)

RERANDOM seeds the random number generator with its input. If RERANDOM is used
without inputs, it uses a random number to seed the gemerator. See also `RANDOM`

.

Rounds a number.

ROUND number

ROUND reports the input number rounded to the nearest integer. See also `INT`

.

Reports the secant.

SEC number

SEC reports the secant of its input.

Reports the sine.

SIN number

SIN reports the sine of its input, which is the number of degrees in an angle.
Remember that SIN x = opposite/hypotenuse. See also `ARCTAN`

and `COS`

.

Reports the square root.

SQRT number

SQRT reports the square root of its input. The input number must be a positive number or 0.

Reports the tangent.

TAN number

TAN reports the tangent of its input, specified in degrees.

TAN 45Result: 1