Difference between revisions of "KTurtle/C2/Grammar-of-TurtleScript-Part-I/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ' > > > {| style="border-spacing:0;" > > |'' Time'' > > |'''Narration''' > > > |- > > | 00.02 > > |Hello Everybody. Welcome to the KTurtle tutorial > > > > > |- > > | 00.05 > > …')
 
Line 2: Line 2:
  
  
>
+
 
>
+
 
> {| style="border-spacing:0;"
+
{| style="border-spacing:0;"
>
+
 
> |'' Time''
+
|'' Time''
>
+
 
> |'''Narration'''
+
|'''Narration'''
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 00.02
+
| 00.02
>
+
 
> |Hello Everybody. Welcome to the KTurtle tutorial
+
|Hello Everybody. Welcome to the KTurtle tutorial
>
+
 
>
+
 
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 00.05
+
| 00.05
>
+
 
> |If this is the first time you are using KTurtle, please see the
+
|If this is the first time you are using KTurtle, please see the
> “Introduction to KTurtle” tutorial on the spoken tutorial website.
+
“Introduction to KTurtle” tutorial on the spoken tutorial website.
>
+
 
>
+
|-
> |-
+
 
>
+
|00.12
> |00.12
+
 
>
+
| To get started with KTurtle, I am using the Linux operating system ubuntu
> | To get started with KTurtle, I am using the Linux operating system ubuntu
+
Version 11.04 and KTurtle version 0.8.1 beta.
> Version 11.04 and KTurtle version 0.8.1 beta.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.21
> | 00.21
+
 
>
+
|This tutorial will help you understand further, the '''Grammar of
> |This tutorial will help you understand further, the '''Grammar of
+
TurtleScript'''.
> TurtleScript'''.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.26
> | 00.26
+
 
>
+
| If you have already installed KTurtle,
> | If you have already installed KTurtle,
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.28
> | 00.28
+
 
>
+
|go to the Ubuntu Menu Item '''Applications >''' '''Education''' and click
> |go to the Ubuntu Menu Item '''Applications >''' '''Education''' and click
+
on the '''KTurtle''' Application.
> on the '''KTurtle''' Application.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.34
> | 00.34
+
 
>
+
|Another way to open KTurtle is by going to '''Applications > Accessories
> |Another way to open KTurtle is by going to '''Applications > Accessories
+
menu and click on Terminal'''
> menu and click on Terminal'''
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.39
> | 00.39
+
 
>
+
| At the prompt type the name of the application that is “'''kturtle'''” and
> | At the prompt type the name of the application that is “'''kturtle'''” and
+
hit 'Enter'.
> hit 'Enter'.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 00.46
> | 00.46
+
 
>
+
|This will open the application.
> |This will open the application.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
|00.51
> |00.51
+
 
>
+
| In this tutorial, we will learn, the grammar of turtle script which
> | In this tutorial, we will learn, the grammar of turtle script which
+
includes,
> includes,
+
 
>
+
 
>
+
|-
>
+
 
>
+
| 00.55
> |-
+
 
>
+
| commands and comments
> | 00.55
+
 
>
+
 
> | commands and comments
+
|-
>
+
 
>
+
| 00.56
> |-
+
 
>
+
| numbers, variables and strings
> | 00.56
+
 
>
+
 
> | numbers, variables and strings
+
|-
>
+
 
>
+
| 00.58
> |-
+
 
>
+
|mathematical and comparison operators
> | 00.58
+
 
>
+
|-
> |mathematical and comparison operators
+
 
>
+
| 01.00
>
+
 
>
+
|and the boolean values
> |-
+
 
>
+
 
> | 01.00
+
|-
>
+
 
> |and the boolean values
+
|01.02
>
+
|And the '''if '''and '''else '''conditions
>
+
 
> |-
+
 
>
+
|-
> |01.02
+
 
>
+
| 01.05
> |And the '''if '''and '''else '''conditions
+
 
>
+
| The '''TurtleScript '''is a programming language and has different types
>
+
of words and symbols.
> |-
+
 
>
+
 
> | 01.05
+
|-
>
+
 
> | The '''TurtleScript '''is a programming language and has different types
+
| 01.10
> of words and symbols.
+
 
>
+
|They are used for different purposes.
>
+
 
> |-
+
 
>
+
|-
> | 01.10
+
| 01.12
>
+
 
> |They are used for different purposes.
+
|And it instructs KTurtle to do something.
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 01.12
+
| 01.15
>
+
|The grammar of TurtleScript can include '''comments and commands, numbers
> |And it instructs KTurtle to do something.
+
and strings .'''
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 01.15
+
| 01.24
>
+
 
> |The grammar of TurtleScript can include '''comments and commands, numbers
+
|Numbers can be stored in ''mathematical operators ''in ''comparison
> and strings .'''
+
operators.''
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 01.24
+
| 01.28
>
+
 
> |Numbers can be stored in ''mathematical operators ''in ''comparison
+
|They can also be stored in variables.
> operators.''
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 01.33
> | 01.28
+
 
>
+
|let us  First have a look at variables, then we look at assigning values to
> |They can also be stored in variables.
+
these variables.
>
+
 
>
+
|-
> |-
+
 
>
+
|01.38
> | 01.33
+
 
>
+
|In the editor of  a Kturtle script ,let us open example for
> |let us  First have a look at variables, then we look at assigning values to
+
a'''variable'''.
> these variables.
+
 
>
+
 
> |-
+
|-
>
+
 
> |01.38
+
|01.43
>
+
 
> |In the editor of  a Kturtle script ,let us open example for
+
|Variables are words that start with a  symbol ‘'''$'''’, for example '''$a'''.
> a'''variable'''.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 01.48
> |01.43
+
 
>
+
|In the editor they are highlighted with the purple color.
> |Variables are words that start with a  symbol ‘'''$'''’, for example '''$a'''.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 01.52
> | 01.48
+
 
>
+
|Using the assignment, '''equal to a variable is given its content.
> |In the editor they are highlighted with the purple color.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 01.56
> | 01.52
+
 
>
+
|Variables can contain any number, string or boolean values (true/false).
> |Using the assignment, '''equal to a variable is given its content.
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 02.05
> | 01.56
+
 
>
+
|It will keep that content until the program finishes the execution or until
> |Variables can contain any number, string or boolean values (true/false).
+
the variable is reassigned to something else.
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 02.05
+
| 02.11
>
+
|You can use variables, once assigned, just as if they are their content.
> |It will keep that content until the program finishes the execution or until
+
 
> the variable is reassigned to something else.
+
 
>
+
|-
>
+
| 02.16
> |-
+
 
>
+
|For example, consider the code being typed in the '''editor'''  now.
> | 02.11
+
 
>
+
 
> |You can use variables, once assigned, just as if they are their content.
+
|-
>
+
 
>
+
| 02.20
> |-
+
 
>
+
|'''$a = 2004 ''''''$b = 25 '''
> | 02.16
+
 
>
+
 
> |For example, consider the code being typed in the '''editor'''  now.
+
|-
>
+
 
>
+
| 02.27
>
+
 
> |-
+
|And'''print $a + $b '''
>
+
 
> | 02.20
+
 
>
+
|-
> |'''$a = 2004 ''''''$b = 25 '''
+
 
>
+
| 02.33
>
+
|First the value 2004 is assigned to the variable '''$a''' .
> |-
+
 
>
+
|-
> | 02.27
+
| 02.37
>
+
 
> |And'''print $a + $b '''
+
|The next the value 2005,25'is assigned to variable '''$b ''.
>
+
 
>
+
 
> |-
+
 
>
+
 
> | 02.33
+
|-
>
+
| 02.42
> |First the value 2004 is assigned to the variable '''$a''' .
+
 
>
+
|The '''print''' command is used to command the turtle to print something on
>
+
the canvas.
> |-
+
 
>
+
 
> | 02.37
+
 
>
+
 
> |The next the value 2005,25'is assigned to variable '''$b ''.
+
|-
>
+
 
>
+
| 02.47
>
+
 
>
+
|'''print '''takes numbers and strings as input.
> |-
+
 
>
+
 
> | 02.42
+
 
>
+
|-
> |The '''print''' command is used to command the turtle to print something on
+
 
> the canvas.
+
| 02.51
>
+
 
>
+
|'''print $a + $b '''will add the two values and the turtle prints the value
>
+
2024.
>
+
 
> |-
+
 
>
+
|-
> | 02.47
+
 
>
+
|02.57
> |'''print '''takes numbers and strings as input.
+
 
>
+
|I am now running the command , you can see that turtle has printed the
>
+
final result.
>
+
 
>
+
|-
> |-
+
 
>
+
| 03.05
> | 02.51
+
 
>
+
| Let us next see the Mathematical and  the Comparison Operators.
> |'''print $a + $b '''will add the two values and the turtle prints the value
+
 
> 2024.
+
 
>
+
|-
>
+
 
> |-
+
| 03.08
>
+
 
> |02.57
+
|The basic mathematical operators here are '''+, - , * , / '''
>
+
 
> |I am now running the command , you can see that turtle has printed the
+
 
> final result.
+
|-
>
+
 
>
+
| 03.16
> |-
+
 
>
+
| In the editor of a Kturtle let us type the following example –
> | 03.05
+
 
>
+
 
> | Let us next see the Mathematical and  the Comparison Operators.
+
|-
>
+
 
>
+
| 03.20
> |-
+
 
>
+
|'''reset'''
> | 03.08
+
 
>
+
 
> |The basic mathematical operators here are '''+, - , * , / '''
+
 
>
+
|-
>
+
 
> |-
+
| 03.23
>
+
|'''canvassize 200,200'''which resizes the canvas to 200 pixels of width and
> | 03.16
+
height each.
>
+
 
> | In the editor of a Kturtle let us type the following example –
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 03.32
> | 03.20
+
 
>
+
|'''$add = 1 + 1'''
> |'''reset'''
+
 
>
+
 
>
+
|-
>
+
| 03.40
> |-
+
|'''$subtract = 20 - 5'''
>
+
 
> | 03.23
+
 
>
+
|-
> |'''canvassize 200,200'''which resizes the canvas to 200 pixels of width and
+
| 03.52
> height each.
+
 
>
+
|'''$multiply = 15 * 2'''
>
+
 
>
+
 
> |-
+
 
>
+
|-
> | 03.32
+
| 03.59
>
+
|'''$divide = 30 /30'''
> |'''$add = 1 + 1'''
+
 
>
+
 
>
+
|-
>
+
 
> |-
+
| 04.05
>
+
 
> | 03.40
+
|'''go 10,10'''
>
+
 
> |'''$subtract = 20 - 5'''
+
 
>
+
|-
>
+
 
>
+
| 04.09
> |-
+
 
>
+
|'''print $add'''
> | 03.52
+
 
>
+
|-
> |'''$multiply = 15 * 2'''
+
>
+
>
+
>
+
> |-
+
>
+
> | 03.59
+
>
+
> |'''$divide = 30 /30'''
+
>
+
>
+
>
+
> |-
+
>
+
> | 04.05
+
>
+
> |'''go 10,10'''
+
>
+
>
+
>
+
> |-
+
>
+
> | 04.09
+
>
+
> |'''print $add'''
+
>
+
>
+
>
+
> |-
+
>
+
 
> | 04.12
 
> | 04.12
>
+
 
> |'''go 50,50'''
+
|'''go 50,50'''
>
+
 
>
+
 
>
+
 
> |-
+
|-
>
+
 
> | 04.15
+
| 04.15
>
+
 
> |'''print $subtract'''
+
|'''print $subtract'''
>
+
 
>
+
 
>
+
 
> |-
+
|-
>
+
| 04.20
> | 04.20
+
 
>
+
|'''go 100,100'''
> |'''go 100,100'''
+
 
>
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 04.25
> | 04.25
+
 
>
+
|'''print $divide'''
> |'''print $divide'''
+
 
>
+
 
>
+
|-
>
+
 
> |-
+
| 04.30
>
+
 
> | 04.30
+
|'''go 0,0'''
>
+
 
> |'''go 0,0'''
+
 
>
+
|-
>
+
 
> |-
+
|04.34
>
+
 
> |04.34
+
| And'''print $multiply'''
>
+
 
> | And'''print $multiply'''
+
 
>
+
|-
>
+
 
>
+
| 04.41
> |-
+
 
>
+
|'''go 175,175'''
> | 04.41
+
 
>
+
 
> |'''go 175,175'''
+
 
>
+
|-
>
+
 
>
+
| 04.49
>
+
 
> |-
+
| The canvas size 200,200 fix the width and height of the canvas to 200
>
+
pixels each.
> | 04.49
+
|-
>
+
|04.55
> | The canvas size 200,200 fix the width and height of the canvas to 200
+
 
> pixels each.
+
| The value 1+1 is assigned to the variable'' $+'',
>
+
 
> |-
+
|-
>
+
 
> |04.55
+
| 04.58
>
+
 
> | The value 1+1 is assigned to the variable'' $+'',
+
| The 20-5 is assigned to variable subtract,
>
+
 
> |-
+
|-
>
+
 
> | 04.58
+
| 05.02
>
+
 
> | The 20-5 is assigned to variable subtract,
+
|The value 15 * 2 will be assigned to the variable ''multiply''.
>
+
 
> |-
+
|-
>
+
 
> | 05.02
+
| 05.06
>
+
 
> |The value 15 * 2 will be assigned to the variable ''multiply''.
+
| 30/30 is assigned to the variable ''Divide.
>
+
 
> |-
+
 
>
+
|-
> | 05.06
+
 
>
+
| 05.10
> | 30/30 is assigned to the variable ''Divide.
+
 
>
+
| We will not print the variables ,the result which is assigned to them and
>
+
the turtle moves in the canvas.
> |-
+
 
>
+
|-
> | 05.10
+
 
>
+
| 05.16
> | We will not print the variables ,the result which is assigned to them and
+
 
> the turtle moves in the canvas.
+
| Let us now run this code.The command which is getting executed is
>
+
highlighted in the editor and the turtle is printing the results.
> |-
+
 
>
+
 
> | 05.16
+
|-
>
+
 
> | Let us now run this code.The command which is getting executed is
+
| 05.34
> highlighted in the editor and the turtle is printing the results.
+
 
>
+
| You can see that the values have been printed on the canvas now.
>
+
 
> |-
+
 
>
+
|-
> | 05.34
+
 
>
+
| 05.39
> | You can see that the values have been printed on the canvas now.
+
 
>
+
| Let us consider a simple example for using the comparison operator .Type the commands being shown on the screen
>
+
 
> |-
+
 
>
+
|-
> | 05.39
+
 
>
+
| 05.46
> | Let us consider a simple example for using the comparison operator .Type
+
 
> the commands being shown on the screen
+
|'''$answer = 10 > 3'''
>
+
 
>
+
|-
> |-
+
 
>
+
| 05.51
> | 05.46
+
 
>
+
|And'''print $answer'''
> |'''$answer = 10 > 3'''
+
 
>
+
|-
>
+
 
>
+
| 06.02
> |-
+
 
>
+
|Here 10 is compared with 3 the ’'''greater than'''’ operator.
> | 05.51
+
 
>
+
 
> |And'''print $answer'''
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 06.08
> | 06.02
+
 
>
+
|The result of this comparison, the boolean value true will be stored in the
> |Here 10 is compared with 3 the ’'''greater than'''’ operator.
+
variable '''$answer, '''and the value '''true '''is printed.
>
+
 
>
+
|-
>
+
 
>
+
| 06.15
> |-
+
| Let me know Run this piece of code,you can see that the turtle has printed
>
+
the value true on the canvas.
> | 06.08
+
 
>
+
 
> |The result of this comparison, the boolean value true will be stored in the
+
|-
> variable '''$answer, '''and the value '''true '''is printed.
+
 
>
+
| 06.24
> |-
+
| lets see how Strings work in this application –
>
+
 
> | 06.15
+
 
>
+
|-
> | Let me know Run this piece of code,you can see that the turtle has printed
+
 
> the value true on the canvas.
+
| 06.27
>
+
|Strings can be put in variables, just like numbers.
>
+
 
> |-
+
 
>
+
|-
> | 06.24
+
 
>
+
| 06.31
> | lets see how Strings work in this application –
+
 
>
+
|Strings cannot be used in mathematical operators or comparison operators
>
+
and Strings are highlighted with red.
> |-
+
 
>
+
|-
> | 06.27
+
 
>
+
| 06.38
> |Strings can be put in variables, just like numbers.
+
 
>
+
|Strings start and end with the '''''''' mark, by these marks KTurtle knows
>
+
that it is a string.
> |-
+
 
>
+
 
> | 06.31
+
|-
>
+
 
> |Strings cannot be used in mathematical operators or comparison operators
+
| 06.45
> and Strings are highlighted with red.
+
 
>
+
|For example:I am typing the print command followed by a string,See that
>
+
the string is highlighted in Red color.
> |-
+
 
>
+
 
> | 06.38
+
|-
>
+
 
> |Strings start and end with the '''''''' mark, by these marks KTurtle knows
+
| 06.56
> that it is a string.
+
 
>
+
| When I run this piece of code, the turtle prints the chain on the canvas.
>
+
 
> |-
+
|-
>
+
 
> | 06.45
+
|07.03
>
+
 
> | For example:I am typing the print command followed by a string,See that
+
| '''Boolean Values'''
> the string is highlighted in Red color.
+
 
>
+
 
>
+
 
> |-
+
 
>
+
|-
> | 06.56
+
 
>
+
| 07.04
> | When I run this piece of code, the turtle prints the chain on the canvas.
+
 
>
+
|There are only two boolean values: ''true ''and ''false''.
>
+
 
> |-
+
 
>
+
 
> |07.03
+
 
>
+
|-
> | '''Boolean Values'''
+
| 07.07
>
+
 
>
+
|For example –I am typing the example for using the boolean value in
>
+
kturtle.
>
+
 
> |-
+
 
>
+
 
> | 07.04
+
|-
>
+
 
> |There are only two boolean values: ''true ''and ''false''.
+
| 07.14
>
+
|'''$answer = 10 > 3'''
>
+
 
>
+
 
>
+
|-
> |-
+
 
>
+
| 07.20
> | 07.07
+
 
>
+
|'''print $answer'''
> |For example –I am typing the example for using the boolean value in
+
 
> kturtle.
+
|-
>
+
 
>
+
| 07.25
>
+
 
>
+
|The turtle choose the value true,the boolean value true is assigned the
> |-
+
variable ''$answer ''is set to ''true ''because 10 is larger than 3.
>
+
 
> | 07.14
+
 
>
+
 
> |'''$answer = 10 > 3'''
+
|-
>
+
 
>
+
|07.36
>
+
 
> |-
+
| '''Executing 'if' '''and ''''else''''conditions.
>
+
 
> | 07.20
+
 
>
+
|-
> |'''print $answer'''
+
| 07.38
>
+
 
>
+
|the code that is placed between the brackets will be executed only ''if
> |-
+
''the ''boolean value ''evaluates 'true'.
>
+
 
> | 07.25
+
 
>
+
|-
> |The turtle choose the value true,the boolean value true is assigned the
+
 
> variable ''$answer ''is set to ''true ''because 10 is larger than 3.
+
| 07.44
>
+
 
>
+
|The code between the brackets after ''else ''is only executed if the ''if
>
+
''condition is false.
> |-
+
 
>
+
 
> |07.36
+
 
>
+
|-
> | '''Executing 'if' '''and ''''else''''conditions.
+
 
>
+
| 07.50
>
+
 
> |-
+
|For example –
>
+
 
> | 07.38
+
 
>
+
|-
> |the code that is placed between the brackets will be executed only ''if
+
| 07.53
> ''the ''boolean value ''evaluates 'true'.
+
 
>
+
|'''reset '''
>
+
 
> |-
+
 
>
+
 
> | 07.44
+
|-
>
+
 
> |The code between the brackets after ''else ''is only executed if the ''if
+
| 07.55
> ''condition is false.
+
 
>
+
|'''$x = 4 '''I now have a sample piece of code on my editor here , which
>
+
compares the numbers 4 and 5 and prints the results accordingly.
>
+
 
> |-
+
 
>
+
|-
> | 07.50
+
 
>
+
| 08.03
> |For example –
+
 
>
+
|Let me now run this code. The turtle has compared the variables 4 and 5 and
>
+
its printing the result 4 is smaller than 6 .
> |-
+
 
>
+
 
> | 07.53
+
|-
>
+
 
> |'''reset '''
+
| 08.18
>
+
 
>
+
|Now to the Assignment part.
>
+
 
> |-
+
 
>
+
 
> | 07.55
+
 
>
+
|-
> |'''$x = 4 '''I now have a sample piece of code on my editor here , which
+
| 08.20
> compares the numbers 4 and 5 and prints the results accordingly.
+
 
>
+
|Using the '''if '''and '''else '''conditions, the '''mathematical
>
+
operators''', solve an equation and print the results using the '''print
> |-
+
'''and '''go '''command.
>
+
 
> | 08.03
+
|-
>
+
 
> |Let me now run this code. The turtle has compared the variables 4 and 5 and
+
| 08.28
> its printing the result 4 is smaller than 6 .
+
 
>
+
|That is you can choose any four random numbers multiply the two sets of
>
+
random numbers, compare the results using the comparison operators and print
> |-
+
both the results and print that greater result at center of the canvas you
>
+
can choose any equation which you like.
> | 08.18
+
 
>
+
|-
> |Now to the Assignment part.
+
 
>
+
| 08.45
>
+
 
>
+
| I would like to acknowledge the spoken tutorial project
>
+
|-
> |-
+
 
>
+
| 08.48
> | 08.20
+
 
>
+
|which is part of the talk to a teacher project.
> |Using the '''if '''and '''else '''conditions, the '''mathematical
+
 
> operators''', solve an equation and print the results using the '''print
+
 
> '''and '''go '''command.
+
|-
>
+
|08.50
> |-
+
 
>
+
|It is supported by the National Mission on Education through ICT, MHRD
> | 08.28
+
government of India.
>
+
 
> |That is you can choose any four random numbers multiply the two sets of
+
 
> random numbers, compare the results using the comparison operators and print
+
|-
> both the results and print that greater result at center of the canvas you
+
| 08.56
> can choose any equation which you like.
+
 
>
+
| you can see more information about this on the link shown on the screen.
> |-
+
 
>
+
 
> | 08.45
+
|-
>
+
 
> | I would like to acknowledge the spoken tutorial project
+
|08.59
>
+
 
>
+
| Thank you this is Sindhu signing off. Enjoy exploring KTurtle.
> |-
+
 
>
+
 
> | 08.48
+
|}
>
+
> |which is part of the talk to a teacher project.
+
>
+
>
+
> |-
+
>
+
> | 08.50
+
>
+
> |It is supported by the National Mission on Education through ICT, MHRD
+
> government of India.
+
>
+
>
+
> |-
+
>
+
> | 08.56
+
>
+
> | you can see more information about this on the link shown on the screen.
+
>
+
>
+
> |-
+
>
+
> |08.59
+
>
+
> | Thank you this is Sindhu signing off. Enjoy exploring KTurtle.
+
>
+
>
+
> |}
+
  
  

Revision as of 10:59, 10 January 2013



> | 04.12
Time Narration


00.02 Hello Everybody. Welcome to the KTurtle tutorial



00.05 If this is the first time you are using KTurtle, please see the
“Introduction to KTurtle” tutorial on the spoken tutorial website.
00.12 To get started with KTurtle, I am using the Linux operating system ubuntu
Version 11.04 and KTurtle version 0.8.1 beta.


00.21 This tutorial will help you understand further, the Grammar of
TurtleScript.


00.26 If you have already installed KTurtle,


00.28 go to the Ubuntu Menu Item Applications > Education and click

on the KTurtle Application.


00.34 Another way to open KTurtle is by going to Applications > Accessories
menu and click on Terminal


00.39 At the prompt type the name of the application that is “kturtle” and

hit 'Enter'.


00.46 This will open the application.


00.51 In this tutorial, we will learn, the grammar of turtle script which
includes,


00.55 commands and comments


00.56 numbers, variables and strings


00.58 mathematical and comparison operators
01.00 and the boolean values


01.02 And the if and else conditions


01.05 The TurtleScript is a programming language and has different types

of words and symbols.


01.10 They are used for different purposes.


01.12 And it instructs KTurtle to do something.


01.15 The grammar of TurtleScript can include comments and commands, numbers
and strings .


01.24 Numbers can be stored in mathematical operators in comparison

operators.


01.28 They can also be stored in variables.


01.33 let us First have a look at variables, then we look at assigning values to
these variables.
01.38 In the editor of a Kturtle script ,let us open example for
avariable.


01.43 Variables are words that start with a symbol ‘$’, for example $a.


01.48 In the editor they are highlighted with the purple color.


01.52 Using the assignment, equal to a variable is given its content.


01.56 Variables can contain any number, string or boolean values (true/false).


02.05 It will keep that content until the program finishes the execution or until
the variable is reassigned to something else.


02.11 You can use variables, once assigned, just as if they are their content.


02.16 For example, consider the code being typed in the editor now.


02.20 '$a = 2004 '$b = 25


02.27 Andprint $a + $b


02.33 First the value 2004 is assigned to the variable $a .
02.37 The next the value 2005,25'is assigned to variable '$b .



02.42 The print command is used to command the turtle to print something on
the canvas.



02.47 print takes numbers and strings as input.


02.51 print $a + $b will add the two values and the turtle prints the value
2024.


02.57 I am now running the command , you can see that turtle has printed the
final result.
03.05 Let us next see the Mathematical and the Comparison Operators.


03.08 The basic mathematical operators here are +, - , * , /


03.16 In the editor of a Kturtle let us type the following example –


03.20 reset


03.23 canvassize 200,200which resizes the canvas to 200 pixels of width and
height each.


03.32 $add = 1 + 1


03.40 $subtract = 20 - 5


03.52 $multiply = 15 * 2


03.59 $divide = 30 /30


04.05 go 10,10


04.09 print $add
go 50,50


04.15 print $subtract


04.20 go 100,100


04.25 print $divide


04.30 go 0,0


04.34 Andprint $multiply


04.41 go 175,175


04.49 The canvas size 200,200 fix the width and height of the canvas to 200
pixels each.
04.55 The value 1+1 is assigned to the variable $+,
04.58 The 20-5 is assigned to variable subtract,
05.02 The value 15 * 2 will be assigned to the variable multiply.
05.06 30/30 is assigned to the variable Divide.


05.10 We will not print the variables ,the result which is assigned to them and
the turtle moves in the canvas.
05.16 Let us now run this code.The command which is getting executed is

highlighted in the editor and the turtle is printing the results.


05.34 You can see that the values have been printed on the canvas now.


05.39 Let us consider a simple example for using the comparison operator .Type the commands being shown on the screen


05.46 $answer = 10 > 3
05.51 Andprint $answer
06.02 Here 10 is compared with 3 the ’greater than’ operator.



06.08 The result of this comparison, the boolean value true will be stored in the
variable $answer, and the value true is printed.
06.15 Let me know Run this piece of code,you can see that the turtle has printed
the value true on the canvas.


06.24 lets see how Strings work in this application –


06.27 Strings can be put in variables, just like numbers.


06.31 Strings cannot be used in mathematical operators or comparison operators
and Strings are highlighted with red.
06.38 Strings start and end with the ''' mark, by these marks KTurtle knows
that it is a string.


06.45 For example:I am typing the print command followed by a string,See that
the string is highlighted in Red color.


06.56 When I run this piece of code, the turtle prints the chain on the canvas.
07.03 Boolean Values



07.04 There are only two boolean values: true and false.



07.07 For example –I am typing the example for using the boolean value in
kturtle.


07.14 $answer = 10 > 3


07.20 print $answer
07.25 The turtle choose the value true,the boolean value true is assigned the

variable $answer is set to true because 10 is larger than 3.


07.36 Executing 'if' and 'else'conditions.


07.38 the code that is placed between the brackets will be executed only if
the boolean value evaluates 'true'.


07.44 The code between the brackets after else is only executed if the if
condition is false.


07.50 For example –


07.53 reset


07.55 $x = 4 I now have a sample piece of code on my editor here , which
compares the numbers 4 and 5 and prints the results accordingly.


08.03 Let me now run this code. The turtle has compared the variables 4 and 5 and
its printing the result 4 is smaller than 6 .


08.18 Now to the Assignment part.



08.20 Using the if and else conditions, the mathematical
operators, solve an equation and print the results using the print
and go command.
08.28 That is you can choose any four random numbers multiply the two sets of
random numbers, compare the results using the comparison operators and print
both the results and print that greater result at center of the canvas you

can choose any equation which you like.

08.45 I would like to acknowledge the spoken tutorial project
08.48 which is part of the talk to a teacher project.


08.50 It is supported by the National Mission on Education through ICT, MHRD
government of India.


08.56 you can see more information about this on the link shown on the screen.


08.59 Thank you this is Sindhu signing off. Enjoy exploring KTurtle.



-- Thanks and regards Madhuri Ganpathi

Contributors and Content Editors

Madhurig, Sneha