Please register and start creating your own cool programs

TurtleAcademy learn programming for freeYour browser is not supporting canvas We recomand you to use Chrome or Firefox browsers

Mouvement de la Tortue

avancer X , av X

Moves the turtle x points

Example:

avancer 50

Explained in lesson:

Logo's turtle

reculer X , rec X

The turtle back x points

Example:

reculer 50

Explained in lesson:

Logo's turtle

àgauche X , gauche X

Rotate the turtle left x degrees

Example:

àgauche 90

Explained in lesson:

Logo's turtle

àdroite X , droite X

Rotate the turtle right x degrees

Example:

àdroite 90

Explained in lesson:

Logo's turtle

accueil

Moves the turtle to center, pointing upwards

Example:

accueil

Explained in lesson:

Turtle world

définirx NUM_x

Move turtle to the specified X location

Example:

définirx 100

Explained in lesson:

Turtle world

définiry NUM_y

Move turtle to the specified Y location

Example:

définiry 200

Explained in lesson:

Turtle world

définirxy NUM_X NUM_Y , set pos [ NUM_X NUM_Y ]

Move turtle to the specified location

Example:

définirxy 100 100

Explained in lesson:

Turtle world

définircap , définirh

Rotate the turtle to the specified heading

Example:

sh 145

Explained in lesson:

Turtle world

arc ANGLE RADIUS

Will create an arc distance RADIUS covering ANGLE angle

Example:

ARC 360 5

Explained in lesson:

Turtle world

ellipse WIDTH HEIGHT

Will create an ellipse with Width and height

Example:

ellipse 80 90

Requêtes de Mouvement de la Tortue

position

Outputs the current turtle position as [ x y ], x or y respectively

Example:

position

Explained in lesson:

The turtle answer

xcor

Outputs the current turtle position as [ x y ], x or y respectively

Example:

xcor

Explained in lesson:

The turtle answer

ycor

Outputs the current turtle position as [ x y ], x or y respectively

Example:

ycor

Explained in lesson:

The turtle answer

cap

Outputs the current turtle heading

Example:

cap

Explained in lesson:

The turtle answer

vers

Outputs the heading towards the specified [ x y ] coordinates

Example:

vers

Explained in lesson:

The turtle answer

Contrôle de la Tortue et de la Fenêtre

montrertortue , montrertortue

Show the turtle

Example:

cachertortue attendre montrertortue

cachertortue , cachertortue

Hide the turtle

Example:

cachertortue

borrar , effacerécran

Will clear the screen

Example:

av 60 borrar

Explained in lesson:

Logo's turtle

effacerécran , effacerécran

Will clear the screen and return the turtle home

Example:

effacerécran

Explained in lesson:

Logo's turtle

remplir

Does a paint bucket flood fill at the turtle's position

Example:

effacerécran répéter 4 [ av 50 droite 90 ] leverstylo définirxy 50 50 abaissersstylo remplir

Explained in lesson:

Background

rempli fillcolor [ statements ... ]

Execute statements without drawing but keeping track of turtle movements. When complete, fill the region traced by the turtle with fillcolor and outline the region with the current pen style

Example:

rempli "blue [repeat 4 [fd 100 droite 90]]

Explained in lesson:

Background

étiquette expr

Draw a word (same logic as print) on the graphics display at the turtle location

Example:

étiquette "logo cachertortue

Explained in lesson:

Background

définirhauteuretiquette expr

Set the height for text drawn by label, in pixels

Example:

définirhauteuretiquette 100 étiquette "Logo cachertortue

Explained in lesson:

Background

envolver

If the turtle moves off the edge of the screen it will continue on the other side

Example:

effacerécran envolver av 800

Explained in lesson:

The turtle borders

ventana

The turtle can move past the edges of the screen, unbounded.

Example:

effacerécran ventana av 600 droite 90 av 100 droite 90 av 70

Explained in lesson:

The turtle borders

valla

If the turtle attempts to move past the edge of the screen it will stop.

Example:

effacerécran valla av 600 droite 90 av 100 droite 90 av 70

Explained in lesson:

The turtle borders

Requêtes sur la Tortue et la Fenêtre

shownp , shown?

Outputs 1 if the turtle is shown, 0 if the turtle is hidden

Example:

show shown?

Explained in lesson:

Interactive

labelsize

Outputs the height of text drawn by label, in pixels

Example:

show labelsize

Explained in lesson:

Interactive

Contrôle du Stylo et de l'Arrière-plan

leverstylo , leverstylo

Turtle stops leaving a trail

Example:

leverstylo

abaissersstylo , abaissersstylo

The turtle will leave a trail

Example:

abaissersstylo

définircouleur X , définircouleurstylo X
Will set the turtle color accroding to the following table
0: noir 1: bleu 2: citron vert
3: cyan 4: rouge 5: magenta
6: jaune 7: blanc 8: marron
9: tan 10: vert 11: aigue-marine
12: saumon 13: violet 14: orange
15: gris

Example:

définircouleur 1

Explained in lesson:

Colors and printing

définircouleur [r,g,b] , définircouleurstylo [r,g,b]

Will set the turtle color accroding to the amount of red , green and blue

Example:

définircouleur [50 100 50]

définirlargeur X , définirtaillecrayon X

Will set the pen width to X

Example:

définirlargeur 4 av 50

Explained in lesson:

The pen width

cambiarforma X or STR , cf X or STR

Will change the turtle to another shape accordin to the following 0 = "turtle", 1 = "cat", 2 = "fish", 3 = "dog", 4 = "horse", 5 = "tiger", 6 = "crab", 7 = "snail"

Example:

cf 1 or cf "dog

Explained in lesson:

Turtle world

Requêtes sur le Stylo

pendownp , pendown?

Outputs 1 if the pen is down, 0 otherwise

Example:

show pendown?

Explained in lesson:

Interactive

pencolor , pc

Outputs the current pen color. This will be a CSS color string, not necessarily the value passed in.

Example:

show pencolor

Explained in lesson:

Interactive

pensize

Outputs a two element list with the pen width and height (usually the same).

Example:

show pensize

Explained in lesson:

Interactive

Définition de Procédures

à PROCNAME inputs ... statements ... end

Define a new named procedure with optional inputs

Example:

à TURTLE répéter 4 [ av 50 droite 90] fin

Explained in lesson:

The turtle is learning

define PROCNAME inputs ... statements ... end

Define a new named procedure with optional inputs

Example:

define "star [[n][repeat 5 [fd :n droite 144]]]

def PROCNAME

Outputs the definition of a named procedure as a string

Example:

show def "star

Définition de Variables

faire varname expr

Update a variable or define a new global variable. The variable name must be quoted

Example:

faire "foo 5

Explained in lesson:

Variables

name expr varname

Like make but with the inputs reversed

Example:

name 5 "myvar

Explained in lesson:

No lesson yet

localmake varname expr

Define a variable in the local scope (shortcut for local then make

Example:

localmake "myvar 5

Explained in lesson:

No lesson yet

: VARNAME , thing VARNAME

Outputs the value of variable. :foo is a shortcut for thing "foo

Example:

show thing "myvar

Explained in lesson:

Variables

Structures de Contrôle

répéter X [ statements ... ]

Repeat statements X times

Example:

répéter 4 [ av 50 droite 90]

Explained in lesson:

Loops

pour controllist [ statements ...]

Typical for loop. The controllist specifies three or four members: the local varname, start value, limit value, and optional step size

Example:

pour [i 1 10 1] [print :i]

Explained in lesson:

The for loop

nombrederépétitions

Outputs the current iteration number of the current repeat or forever

Example:

répéter 4 [ nombrederépétitions ]

si expr [statement]

Execute statment if expressoin is true

Example:

si 2>1 [print "hello]

sino expr [statementTrue] [statementFalse]

Execute StatementTrue if tru else execute statementFalse

Example:

sino 0>1 [print "true] [print "false]

test expr

Test the specified expression save the result in the local scope for the subsequent use by iftrue iffalse

Example:

test 3>4 siverdad [print "true] sifalso [print "false]

siverdad [statements]

Example:

test 3>4 siverdad [print "true] sifalso [print "false]

sifalso [statements]]

Example:

test 3>4 siverdad [print "true] sifalso [print "false]

attendre X

Will cause the turtle to wait X ( 60ths of seconds ) time before executing the command

Example:

répéter 4 [ attendre 10 av 50]

Explained in lesson:

Hi wait

adios

Ternimante the program

Example:

adios

dotimes [varname times] [ statements ...]

Run the statements the specified number of times. The variable varname is set to the current iteration number.

Example:

dotimes [ i 5 ] [ show :i * :i ]

do.while [ statements ...] expr

Runs the specified statements at least once, and repeats while the expression is non-zero (true).

Example:

do.while [ faire "a aléatoire 10 show :a ] :a < 8

while [expr] [ statements ...]

Runs the specified statements only while the expression remains non-zero (true).

Example:

while (random 2) = 0 [ show "zero ] show "one

do.until [ statements ...] [expr]

Runs the specified statements at least once, and repeats while the expression is zero (false).

Example:

do.until [ faire "a aléatoire 10 show :a ] :a < 8

until [expr] [ statements ...]

Runs the specified statements only while the expression remains zero (false).

Example:

until (random 2) = 0 [ show "one ] show "zero

Listes

liste thing1 thing2 ...

Create a new list from the inputs

Example:

faire "mylist (list "turtle "academy)

Explained in lesson:

Listes

premier listname

Outputs the first item from the list

Example:

imprimer premier :mylist

Explained in lesson:

Listes

maisd’abord listname

Outputs all the items of listname except for the first item

Example:

imprimer maisd’abord :mylist

Explained in lesson:

Accessing the list

dernier listname

Outputs the last item from the list

Example:

imprimer dernier :mylist

Explained in lesson:

Listes

maisdernier listname

Outputs all the items of listname except for the last item

Example:

imprimer maisdernier :mylist

Explained in lesson:

Accessing the list

élément index listname

Outputs the indexlist item of the list or array

Example:

imprimer élément 1 :mylist

Explained in lesson:

Accessing the list

choisir index listname

Outputs one item from a list, at random

Example:

imprimer choisir :mylist

Explained in lesson:

Accessing the list

Mathématiques

somme X Y

Will sum x+y

Example:

imprimer somme 2 3

Explained in lesson:

Variables

moins X Y

return the distance between x and y x-y

Example:

imprimer moins 8 2

aléatoire X

Will choose a random number between 0 - (X-1)'

Example:

effacerécran imprimer somme aléatoire 10 3

Explained in lesson:

Colors and printing

modulo expr expr

Outputs the remainder (modulus). For remainder and % the result has the same sign as the first input; for modulo the result has the same sign as a the second input.

Example:

effacerécran imprimer modulo 10 3

power expr expr

3 power 4 = 81

Example:

show power 3 4

Receivers

leerpalabra

Prompt the user for a line of input. The result (including spaces) is the single word output.

Example:

faire "name (readword [What is your name?]) show :name

Explained in lesson:

Interactive

leerlista

Prompt the user for a line of input. The result is a list of words.

Example:

faire "colors (readlist [Type some colors:]) show :colors

Prédicats

word thing , word? thing

Returns true (1) or false (0) if thing is a word

Example:

show word "hello

listp thing , list? thing

Returns true (1) or false (0) if thing is a list

Example:

imprimer listp [1 2 3]

arrayp thing , array? thing

Returns true (1) or false (0) if thing is an array

Example:

imprimer arrayp array 2

numberp thing , number? thing

Returns true (1) or false (0) if thing is a number

Example:

imprimer numberp 25

emptyp thing , empty? thing

Test if thing is an empty list or empty string.

Example:

imprimer emptyp []

equalp expr expr , equal? expr expr

Test if xper expr are equal.

Example:

equalp "no "yes

notequalp expr expr , notequal? expr expr

Test if xper expr are not equal.

Example:

notequalp "no "yes

beforep thing1 , before? thing1

Test string collation order.

Example:

imprimer before? "bye "hi

substringp thing1 thing2 , substring? thing1 thing2

Test if thing1 is a substring of thing2.

Example:

imprimer substringp "hello "helloworld