Working with Words 1
Basics | Joining Words | Labels on Screen |
Basics
Type or cut and paste this code into the command line print [hello world] This is the easiest way to get the machine to output a line of text. |
Type or cut and paste this code into the command line repeat 4 [print [hello world]] This just does it 4 times instead of once! |
Joining Words Together.
Type or cut and paste this code into the command line make "w1 "hello make "w2 "world Hit return and then type in: show word :w1 :w2 Then try: show sentence :w1 :w2 |
Open the editor and paste in this procedure. to talkrubbish Save and exit from the editor and then type talkrubbish into the command line. Convince yourself that there are 8 possible answers! That is 23 combinations |
Writing Labels to the Screen.
Type or cut and paste this code into the command line cs label "hello You should have hello written up the screen Now try: cs rt 90 label "hello "hello" should now be horizontal. show sentence :w1 :w2 |
|
Try this code: cs pu repeat 20 [setxy repcount*20 repcount*5 rt 20 label "hello] setxy puts the turtle at point x,y on the screen. |
|
You can alter the font using the set and Label Font menu. |
You could set the font and colour in the middle of a procedure by using setfontlabel to set the font and setpc to set the pencolour. Setting the pen colour is easy but you need to look at the help file to get at the 12 different numbers needed to control the font! |
You can print the value of a variable by placing it after the label command. cs pu repeat 20 [fd 30*(1+repcount/20) rt 20 label repcount] |
Last updated 23rd February 2010