2. Instructions
returning a value:
**************************
These instructions are useful for calculating numbers.
absolute (number);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: absolute value of the parameter
description: returns the absolute value of a number.
examples:
variable = absolute(-4);
//the value of variable is 4
arccosine (value);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the angle corresponding to the value
description: returns the arccosine of a value ( in degrees ).
examples:
arccosine(0);
variable = -1;
arccosine(variable);
arcsine (value);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the angle corresponding to the value
description: returns the arcsine of a value ( in degrees ).
examples:
arcsine(0);
variable = 0;
arcsine(variable);
cosine (angle);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the cosine of the angle
description: returns the cosine of an angle in degrees.
examples:
cosine(28);
variable = 12/3;
cosine(variable);
logarithm (number);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the logarithm of a number
description: returns the logarithm of a number, in base e.
examples:
logarithm(14);
variable = 300;
logarithm(variable);
read character (variable);
type of parameter(s): none
default parameter(s): none
value returned: keyboard character
description: stops execution until the user hits a keyboard key; the
character hit will be returned as the value of the variable in
parenthesis. If the value of the variable is a number, it can be
added, divided, etc.
example :
read character(variable);
sinus (angle);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the sinus of the angle
description: returns the sinus of the angle.
examples:
sine(28);
variable = 12/3;
sine(variable);
square root (number);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the square root of a number
description: returns the square root of a number.
examples:
square root(28);
variable = 12/3;
square root(variable);
tangent (angle);
type of parameter(s): floating point number (ex:
32.887),with up to 7 digits after the period.
default parameter(s): none
value returned: the tangent of the angle
description: returns the tangent of the angle.
examples:
tangent(28);
variable = 12/3;
tangent(variable);
3.Variables:
*********
There is a certain number of pre-defined variables. Most of these,
followed by an asterisk *, cannot have their value changed by
the user : these variables are read-only variables.
Note : to find out to what color the basic color is, use
the following instruction : print(color);. For example, print(blue);
returns 009.
Here are the colors and their corresponding numbers for this
function:
brown 500
blue 009
gray 555
yellow 990
purple 909
black 000
orange 930
red 900
green 090
cyan 099
white 999
character font
description: returns the name of the font in use.
example :
variable = character font;
print(variable);
character style
description: returns a number corresponding to the following
table :
Style Number
Plain 0
Bold 1
Italic 2
Underline 4
Outline 8
Shadow 16
Condense 32
Extend 64
For example, if the style is bold and italic, the value of character
style is 1+2 = 3 .
examples:
variable = character style;
print(variable);
character size*
description: returns the size of the font in use
examples:
variable = character size;
print(variable);
random*
description: returns a value between 1 and random scale.
examples:
fill square(30,random);
variable = random;
forward(variable);
forward(random);
random scale
description: largest value of the random scale; default value is
10.
examples:
random scale=25;
forward(random scale);
variable = random scale;
forward(variable);
receive angle*
type of parameter(s): none
default parameter(s): none
value returned: orientation of the turtle
description: orientation (in degrees) of the turtle
example :
variable=receive angle;
receive x*
type of parameter(s): none
default parameter(s): none
value returned: horizontal position of the turtle
description: horizontal position of the turtle
example :
variable=receive x;
receive y*
type of parameter(s): none
default parameter(s): none
value returned: vertical position of the turtle
description: vertical position of the turtle
example :
variable=receive y;
return*
description: contains the "return" key on the keyboard.
examples:
variable=return;
// variable now contains the "return" key.
x dimension*
description: gives the horizontal size of the screen in pixels.
example:
forward(x dimension);
x position*
description: returns the horizontal position of the cursor.
example :
if(x position>10);
{
forward(22)
}
y dimension*
description: gives the vertical size of the screen in pixels.
example:
forward(y dimension);
y position*
description: returns the vertical position of the cursor.
example :
if(y position>10);
{
forward(22)
}
You can now create the most elaborate function. We suggest
that you try out the functions given with Learn and Play
: these are called "Logo Samples" and can be imported
directly from the software by using the "Import..." command from the
"Program" menu. These functions use many of the functions and
variables defined in this guide.
**********************************************