Video LessonsReference
Testing for UnderstandingRelated LinksLogo How-TosLogo SoftwareLogo OrganizationsLogo ForumsThe work on this shelf is powered by you andMicroWorlds Web Player is officially supported under Internet Explorer or Netscape 4 or higher |
Logo Programming BasicsDefinitions
An instruction is a command together with the inputs it needs to do its work. For example, the line below contains two instructions: fd 5 wait 1 A group of instructions that do a particular job is called a procedure. You can write your own procedures or use procedures called primitives that come with MicroWorlds.
Commands are procedures that are used to change the state of projects, pages, turtles, buttons, sliders, text boxes, colors, hyperlinks, media objects, dialog boxes, choosers and the Command Center. Commands don't report output to other procedures Examples of commands: presentationmode, page1, setx, fd, setslider1, set. The following procedures are not commands: xcor, sum, word, get.A procedure that reports output to other procedures is called a reporter. The OP command is used to report output from procedures that you write yourself. Examples of reporters: color, quotient, first, text1, get. The following procedures are not reporters: freezebg, page1, setc, fd, settext1, set. Input is the information a procedure needs before it can be invoked. For example, in the following instruction fd 50 50 is the input to the fd command Output is the information reported by a reporter. For example, in the instruction below fd product 5 10 the output of the product reporter is 50. A word is a collection of characters. The simplest way to get Foo to evaluate something as a word is to put quotation marks in front of it. Foo also recognizes numbers as words. Here are some words: "hello 25 "|a word with spaces| "@.#% Notice that an opening and closing bar (|) is used to make a word that contains spaces. Reporters may report words, but they may also report lists. Commands never report words or anything else. A list is a collection of words. Brackets are used to show the beginning and end of a word. Here is a list: [How are you?] A list can be a member of a list. [[chocolate fudge] vanilla [cherry garcia]] The list above has three members. The first and third members are lists, and the second member is a word. An instruction is evaluated when Foo reads it and decides whether to invoke a procedure, look for more input, or send back an error message. For example, suppose your project page has a text box called text1 and text1 has a 7 in it. You send the following message to Foo: settext1 sum text1 1 Foo first evaluates text1 and next evaluates sum 7 1 and finally settext1 8 A procedure is invoked when it is made to do it work. Procedures are invoked in a particular order. For example, suppose you sent the following message to Foo: show butfirst [show rest of words] The first thing Foo sees is show, but he can't invoke show until he gets input for it, so the first procedure to be invoked is butfirst: butfirst [show rest of words] now Foo can invoke show: show [rest of words] Messages from FooMicroWorlds Episode 1: Introducing Foo
MicroWorlds Episode 2: Foo's language
MicroWorlds Episode 2 Redux: What was that again?
MicroWorlds Episode 3: Words in Logo as understood by Foo
MicroWorlds Episode 4: Why doesn't this command like that word as input?
MicroWorlds Episode 5: Lists
|
Leone Learning Systems, Inc. (LLS) is a North Shore company that provides online courses for kids anywhere and local teaching and tutoring services for students in Chicago and the Northern Suburbs of Chicagoland. LLS also provides a free geometry software package for children age 6 and up, and free resources for teachers and parents. This site includes information about classes taught, availability for tutoring, learning activities for kids, lesson plans, and ongoing software and curriculum research and development efforts. |
|