← ict
Unit 6: LOGO Grade 8
6.1 below. p.97
UNIT
Logic Oriented Graphics
Oriented (LOGO) Programming
Unit Outcomes
At the end of this unit, students will be able to :
explain primitives;
describe the use of variable in writing procedure;
create recurring procedure and
write program using conditional statement;
Overview
In Grade 7, you have learned about Logic Oriented Graphics Oriented
(LOGO) language. You have already known that; LOGO is one of the
easiest and simplest computer languages. As you remember, LOGO uses
to perform various functions such as drawing figures, typing text and
performing calculations. In this unit, you will learn about using variables
in writing LOGO procedures and creating recursive procedures in LOGO.
LOGO 6.5 b version was used in this textbook; which is available on the site
“https://mswlogo.en.softonic.com/download”.
Brainstorming activity
Why do you learn the LOGO language?
Write some of LOGO turtle commands you
learned in grade 7?
6.1. LOGO Primitives
LOGO uses a triangle shaped turtle that moves on the MSW Microsoft
Windows (MSW) LOGO screen. The LOGO turtle can draw and
perform actions when you give a command. These commands are
also known as primitives. Primitives are entered in the bar called
command input box. The basic LOGO primitives are shown in Table
Table 6.1 LOGO Primitives
Primitives Meaning Action
FD Forward to move the turtle forward.
BK Back to move the turtle backwards.
RT Right to move the turtle to the right.
LT Left to move the turtle to the left.
HT Hide Turtle to hide the turtle.
ST Show Turtle to show the turtle.
to clear the screen and send the
CS Clear Screen
turtle to the Home position.
to clear all the commands in
CT Clear Text
the recall list box.
to bring the turtle to its Home
HOME Home
position.
PRINT Print to write.
SUM Sum to add two numbers.
to subract one number to an-
DIFFERENCE Difference
other.
PRODUCT Product to multiply to number.
PU Penup to moves turtle without line.
to puts the pen down, and
PD Pendwn
starts drawing again.
Sqrt Square Root It takes a non-negative and
returns its square root.
Exp Exponential It bends an argument and com-
pute e to this power, e is the
natural number 2.718281828.
Grade 8 Ict (new curriculum) p.99
6.2. Variables in LOGO
A variable is the name of a memory location which can contain a value.
Variables are given names which are strings of letters. A variable
name can contain alphabets, digits and underscore. Variables are like
containers; they contain some “thing” inside. This topic discusses
how to make your own variables, how to get at the “thing” inside.
Every variable has a name and a value associated with it. A name is a
word, just like the words you have used for the names of turtles. A
variable is something that can vary.
To define a variable in MSW LOGO, use a statement in the form:
MAKE “variableName value
e.g. make “size 10
In this example ,the variable called “size” will now have a value of
ten (10).
If you want to make use of a variable in a procedure, you must refer to
it by writing a colon (“:”) in front of the variable name. In the example
above you would refer to the variable in the form - : size. If you just
write the word “size”, without the colon, MSW LOGO will treat it as
a text, rather than the value it contains.
Example .
make “size 60
print :size/2
There are several ways to give a value to a variable. An explicit way
to do this is described below. An implicit way will be seen when we
introduce procedures. A variable can be given a value with the make
command, as shown below.
make “size 60
This command gives size to the value 60. Note that in this case, we
have used ``size, not :size. The reason is that: size is the value of the
variable size, while ``size is its name. We say that ``size is the ``quoted
name’’ of size. LOGO tries to ``evaluate’’ words as it reads them
because some words are the names of procedures. We quote words to
tell LOGO, that they should not be evaluated. In LOGO variables do
not have types, nor do they have to be declared before used.
92 93
make “size 60
print :size +2
print :size-2
print size*2
Now let us give the variable name a value which is the name of
the Hello. Try executing the following commands in the command
window.
make “name “Hello
print :name
Note that we quote the name of the variable name in the make
command but we use the colon version to obtain its value. Hello is
quoted so it is recognized as string and not as a variable. Its output is
Hello.
6.3. Recursive procedures
When you use LOGO, each time you type a command (or a set of
commands), the turtle moves immediately. However, the turtle does
not “remember” how to make the shape. To create the shape again,
you need to type the commands again. A procedure is a way to make
the turtle remember a set of commands.
Each procedure is given a name (e.g., SQUARE or HOUSE or BIG,RED.
THING). The name may not include spaces. Creating the procedure
is like teaching the LOGO turtle the meaning of a word. For example,
we can teach the turtle that the word SQUARE means REPEAT 4 [FD
50 RT 90]. Afterwards, every time we type the word SQAURE, the
turtle will know what to do. Procedures are kept in memory as part
of a LOGO workspace. The workspace is a collection of all the LOGO
procedures currently in memory. These workspaces can be saved and
loaded, just like other documents.
Creating a Procedure using TO
All LOGO procedures actually have the word ‘TO’ as part of the name
(e.g., TO SQUARE or TO HOUSE). All versions of LOGO allow this
method for creating procedures. To begin a procedure, type the word
TO and a name for the procedure. For example, you could type TO
NAME or TO TRIANGLE.
Grade 8 Ict (new curriculum) p.101
Creating a Procedure using EDIT
There is no space between the quote and the name of the procedure.
There is no quote after the procedure name. Many LOGO commands
follow this pattern.
You will probably see the following two lines in the editing window
when you begin a new procedure:
TO SQUARE
END.
You will be typing the commands between these two lines, so you
may need to press Return/Enter to open up a space to type.
Finishing and saving a procedure using EDIT will depend on the
version of LOGO you are using. There may be a menu item such as
“Save and Exit”. The simplest way is to attempt to close the editing
window. The computer asks you if you want to save the changes.
Example: To display the output of fd 100 rt 90 fd 100 procedure in
MSWLOGO;
1. Open MSW LOGO;
2. Go to MSWLOGO screen;
3. From the MSWLOGO screen menu, click on File then edit;
4. Type square on Edit Procedure form then ok;
5. Then editor automatically displays form as follows.
6. To square
7. End
8. Type the above procedure between to square and end;
9. Then click on File and then save and exit;
10. Then on the commander command, enter box type square, click
execute and you get the following output shown in figure 6.1.
94 95
Figure 6.1: Code and Output
Activity 6.1
Create the following procedures and view their output.
a.
to square
fd 100 rt 90 fd 100 rt 90 fd 100
end
b.
to square
fd 100 rt 90 fd 100 rt 90 fd 100 rt 90 fd 100 rt 90
end
In a recursive procedure, there will be a call of the procedure within
the procedure. First of all, just what is a procedure? Let us look at
it this way. What procedures do you follow when you wake up in
the morning? You get out of bed. Some people have a lot of trouble
with that. You get cleaned up, put on your clothes, eat your breakfast,
brush your teeth, and go to school or elsewhere. Procedures are how
you do things, the steps you take to make something happen. LOGO
procedures are things you teach LOGO to do. They include all the
Grade 8 Ict (new curriculum) p.103
steps LOGO must take to make something happen.
When a procedure invokes a copy of itself, it is said to be recursive.
The meaning of recursive procedures is obtained in exactly the same
way as regular procedural invocation, namely, via the copy rule. An
example of a recursive procedure is given below.
to star
repeat 100 [fd 100 rt 144]
end
The above recursive procedure output is displayed below.
Figure 6.2: Code and Output
6.4. Conditional Statements
Conditional statements are statements that are used to decide whether
or not the condition is true or false. Conditional statements always
have if part which tells the application what to do when the condition
is true. Conditional statements also usually have an else part, which
96 97
tells the app what to do when the condition is false. If you leave out
the else part then your application will do nothing when the condition
is false.
Conditional Command: if else
General form:
ifelse [true/false condition][action if true][action if false]
Example 1
make “variable1 23 // variable 1 is equal to 23
make “variable2 23 // variable 2 is equal to 23
ifelse :variable1 = :variable2 [print [It’s TRUE]][print [It’s
FALSE]]
In MSWLOGO editor the above example 1 code is written as follows.
Figure 6.3: Example 1 code in LOGO
The MSWLOGO display the output for the above example 1 code as
follows.
Figure 6.4: Output of example 1
Grade 8 Ict (new curriculum) p.105
Example 2
make “variable1 23 // variable 1 is equal to 23
make “variable2 25 //variable 1 is equal to 25
ifelse :variable1 = :variable2 [print [It’s TRUE]][print [It’s FALSE]]
In MSWLOGO editor the above example 2 above code is written in
the following way.
Figure 6.5 Example 2 code in LOGO
The MSWLOGO displays the output for the above figure 6.6 as follows.
Figure 6.6: Output of example 2
98 9
Conditional Command: Using until and while
General form:
until [condition][action]
while [condition][action]
make “count 1
until [:count > 5][print :count make “count :count + 1]
Output: 1 2 3 4 5
make “count 5
while [:count < 10][print :count make “count :count + 1]
Output: 5 6 7 8 9 10
Conditional Command: do.until, do.while
do.until and do.while are effectively the same as until and
while except that the <action> and <condition> are reversed.
Using until and while
General form:
do.until [action][condition]
do.while [action][condition]
make “count 1
do.until [print :count make “count :count + 1][:count > 10]
Output: 1 2 3 4 5 6 7 8 9 10
make “count 1
do.while [print :count make “count :count + 1][:count < 10]
Output: 1 2 3 4 5 6 7 8 9
Grade 8 Ict (new curriculum) p.107
Activity 6.2
Find the output for the following LOGO programs
1.
make “variable1 50
make “variable2 51
ifelse :variable1 = :variable2 [print [It’s TRUE]][print
[It’s FALSE]]
2.
make “count 12
until [:count > 20] [print :count make “count :count + 2]
3.
make “add 1
do.until [print :add make “add :add + 5][:add > 15]
4.
TO SQUARE
REPEAT 4 [FD 100 RT 90]
END
REPEAT 20 [SQUARE RT 20]
100 101
Summary
In this unit, you have learned about primitives, variables, procedure
and conditional statements in LOGO programming.
Primitives are commands in LOGO programming.
Variable is the name of a memory location which can con
tain a value.
Variables are given names which are strings of letters.
Procedure is a way to make the turtle remember a set of
commands.
Creating the procedure is like teaching the LOGO turtle
the meaning of a word.
Recursive is a procedure that invokes its own copy.
Conditional statements are statements that are used to de
cide whether or not the condition is true or false.
Grade 8 Ict (new curriculum) p.111
via a port. device developed from
semiconductor materials.
External Hard Drive: is a
storage device that serves Keyboard: is where all
as an extra hard drive the letters, numbers and
used for additional or other buttons are located;
backup storage. when you type on it, the
symbols appear on the
Hard Driver: is an input/
monitor.
output device that serves
as the long-term storage Laptop: is a small portable
memory of the computer. computer.
Home Page: is a first page Link: is a word, phrase,
of a Website, it is similar or image that allows
to a table of contents. you to jump to another
document on the World
HTML: is a computer
Wide Web.
language used to make
hypertext documents that Microphone: is a device,
are sent via the World which allows you to talk
Wide Web and viewed to others through your
using a Browser. computer provided that
you are connected to them
HTTP: is a way that
via a communication
hypertext documents
application.
are transferred over the
Internet. Modem: is a device that
allows a computer to
Hypertext: is a way of
connect to the intranet.
presenting information
that allows words, Monitor: is an output
pictures, sounds, and device that displays
actions to be inter-linked information visually.
so that you may jump
Motherboard: is a
between them as you
circuit board that holds
choose.
and connects various
Integrated circuit: refers components of the
to a small electronic computer and allows their
104 105
communication. Scanner: is a device that
scans something that is
Mouse: is a little device
flat and sends the image
you move with your
to the computer.
hand, which then moves
the cursor on the screen. Search Engine: is a
website that indexes
Operating System:
and allows searching of
is software that
information gathered
communicates with the
from the internet.
hardware and allows
other programs to run. Smartphone: is a portable
device that combines
Optical Driver: is an
mobile telephone and
input/output device that
computing functions into
reads data from and
one unit.
writes data to CDs and
DVDs. Speakers: are devices that
the sounds come out of;
Peripheral: is an
they are sometimes built
accessory that you use
into the monitor.
with your computer;
not part of the computer Touchpad: is an area on
itself, but it connects to a laptop that substitutes
the computer via a cable for a mouse; you move
or wireless access; for your finger around on it
example, printers and to move the cursor.
scanners.
Transistor: is an electronic
Printer: is a device that device used to control
prints out data sent from the flow of electricity in
the computer onto paper. electronic equipment.
RAM: is a computer’s URL: is a uniform resource
high-speed, short-term locator -The entire address
memory. It temporarily for a piece of information
stores data and of the internet. E.g., www.
instructions for programs google.com
that run on the computer.
Utility software: is system
Grade 8 Ict (new curriculum) p.113
software used to solve a transistors.
particular problem of a
Webpage: is a hypertext
user.
document available on
Vacuum tube: is an the World Wide Web.
electronic device that
Website: is a collection of
controls the flow of
webpages.
electrons in a vacuum.
World Wide Web: is a
Very Large Scale
collection of resources
Integrated circuit: is the
available on the internet
current level of computer
using a web browser.
microchip containing
hundreds of thousands of
Bibliography
Basic Concepts of Computer, available at the link http://uru.
ac.in/uruonlinelibrary/Cloud_Computing/Basics%20of%20
Computer.pdf
Basics of power point, available at the link https://www.
tutorialspoint.com/powerpoint/powerpoint_tutorial.pdf
Basics of Word processor, available at the link https://www.
tutorialspoint.com/word/word_tutorial.pdf
Computer Basics Concepts, available at the link https://www.
vfu.bg/en/e-Learning/Computer-Basics--computer_basics2.
pdf
Computer Basics: Student Edition Complete, 2003 by Custom
Guide. available at the link https://www.uc.edu/webapps/af/
hr/CUSTOMGUIDE/content/content/computerbasics.pdf
Computer Ergonomics, available at the link https://www.ehs.
iastate.edu/publications/ebooks/Ergonomics.pdf
Computer Fundamentals, available at the link https://www.
tutorialspoint.com/computer_fundamentals/computer_
fundamentals_tutorial.pdf
106 107
Computer Workstation Ergonomics, available at the link
https://www.worksafenb.ca/media/61622/computer_
workstation_ergonomics.pdf
DamtewWolde (2005). An Overview of the Information and
Communication Technology for Education in Ethiopia, IER
Flambeau, Vol. 13. No. 1
Daniels J.S. (2002) “Foreword” in Information and
Communication Technology in Education–A Curriculum
for Schools and Program for Teacher Development. Paris:
UNESCO.
Davidson, C., &Tolich, M. (Eds.). (2003). Social science
research in New Zealand: Many paths to understanding. (2nd
ed.). Auckland: Pearson Education.
Ergonomics and the Computer Workstation Occupational
Health, available at the link http://www.mtpinnacle.com/
pdfs/Ergonomics.pdf
Excel Fundamentals, available at the link https://www.sgul.
ac.uk/about/our-professional-services/information-services/
library/documents/training-manuals/Excel-Fundamentals-
Manual.pdf
Excel Fundamentals, Ebook available at the link https://
www.computer-pdf.com/office/excel/931-tutorial-excel-
fundamentals.html
Fundamentals of ergonomics in theory and practice,
available at the link https://citeseerx.ist.psu.edu/viewdoc/
download?doi=10.1.1.113.3542&rep=rep1&type=pdf
Getahun, A. (2006) ICT is Ethiopia‟s Number One Priority,
Developing Telecoms.com.
Grabe, M., (2001), Integrating Technology for Meaningful
Learning. Houghton Muffin
Introduction To Computer System, available at the link http://
www.tmv.edu.in/pdf/Distance_education/BCA%20Books/
Grade 8 Ict (new curriculum) p.115
BCA%20I%20SEM/BCA-121%20Computer%20Fundamental.
pdf
Microsoft Excel: Fundamentals Participant Guide, available
at the link https://www.towson.edu/technology/training/
resources/documents/office2016/ex1601-excel-2016-
fundamentals.pdf
Microsoft Word Basics, available at the link https://www.
noblenet.org/salem/reference/wp-content/uploads/2017/01/
word.pdf
Power point basics, Ebook available at the link https://library.
ku.ac.ke/wp-content/downloads/2011/08/Bookboon/Office-
programs/microsoft-office-powerpoint.pdf
Word – Fundamentals, available at the link https://www.sgul.
ac.uk/about/our-professional-services/information-services/
library/documents/training-manuals/Word-Fundamentals-
Manual.pdf
Word Processor for Beginners, available at the link http://
media.news.health.ufl.edu/misc/training/Handouts/Basics/
Beginner-Word.pdf
108 109
← መጻሕፍት