Fill in the blanks.
1. The___________command gives everything but the first part of a thing.
2. The__________command gives everything but the first part of a thing.
3. PRINT BUTLAST [down up] will show___________.
Answers
Answer:
Logo is one of the most powerful programming languages around. In order to take advantage of that power, you must understand Logo's central ideas: procedures and evaluation. It is with these ideas that our exploration of Logo programming begins.
Procedures and Instructions
In response to Logo's question-mark prompt, type this instruction:
print 17
Logo will respond to this instruction by printing the number 17 and then printing another question mark, to indicate that it's ready for another instruction:
? print 17
17
(Remember, the underlined things are the ones you should type; what's not underlined is what the computer prints.)
This instruction doesn't do much, but it's important to understand how it's put together. The word print is the name of a procedure, which is a piece of a computer program that has a particular specialized task. The procedure named print, for example, has the task of printing things on your screen.
If you have previously used some other programming language, you may be accustomed to the idea of different statement types making up the repertoire of the language. For example, BASIC has a print statement, a let statement, an input statement, etc. Pascal has an assignment statement, an if statement, a while statement, etc. Each kind of statement has its own syntax, that is, its own special punctuation and organization. Logo is very different. It does not have different kinds of instructions; everything in Logo is done by the use of procedures. If Logo is your first programming language, you don't have to worry about this. But for people with previous experience in another language, it's a common source of misunderstanding.
When you first start up Logo, it "knows" about 200 procedures. These initial procedures are called primitive procedures. Your task as a Logo programmer is to add to Logo's repertoire by defining new procedures of your own. You do this by putting together procedures that already exist. We'll see how this is done later in this chapter.
The procedure print, although it has a specific task, doesn't always do exactly the same thing; it can print anything you want, not always the number 17. (You've seen several examples in Chapter 1.) This may seem like an obvious point, but later you will see that the flexibility of procedures is an important part of what makes them so powerful. To control this flexibility, we need a way to tell a procedure exactly what we want it to do. Therefore, each procedure can accept a particular number of inputs. An input is a piece of information. It can be a number, as in the example we're examining, but there are many other kinds of information that Logo procedures can handle. The procedure named print requires one input. Other procedures will require different numbers of inputs; some don't require any.
Technical Terms
In ordinary conversation, words such as instruction and procedure have pretty much the same meaning--they refer to any process, recipe, or method for carrying out some task. That's not the situation when we're talking about computer programming. Each of these words has a specific technical meaning, and it's very important for you to keep them straight in your head while you're reading this chapter. (Soon we'll start using more words, such as command and operation, which also have similar meanings in ordinary use but very different meanings for us.)
An instruction is what you type to Logo to tell it to do something. Print 17 is an example of an instruction. We're about to see some more complicated instructions, made up of more pieces. An instruction has to contain enough information to specify exactly what you want Logo to do. To make an analogy with instructing human beings, "Read Chapter 2 of this book" is an instruction, but "read" isn't one, because it doesn't tell you what to read.
A procedure is like a recipe or a technique for carrying out a certain kind of task. Print is the name of a procedure just as "lemon meringue pie" is the name of a recipe. (The recipe itself, as distinct from its name, is a bunch of instructions, such as "Preheat the oven to 325 degrees.") A procedure contains information about how to do something, but the procedure doesn't take action itself, just as a recipe in a book can't bake a pie by itself. Someone has to carry out the recipe. In the Logo world something has to invoke a procedure. To "invoke" a procedure means to carry it out, to do what the procedure says. Procedures are invoked by instructions. The instruction you gave just now invoked the procedure named print.
i hope it's helpful to u. ❤