Mumpster
http://mumpster.org/

Unit 1 - Lesson 7: Editing and Executing Routines
http://mumpster.org/viewtopic.php?f=29&t=753
Page 1 of 1

Author:  tlwiechmann [ Tue May 24, 2011 3:10 pm ]
Post subject:  Unit 1 - Lesson 7: Editing and Executing Routines

The goals of this lesson are to:

  • Use your favorite editor to create and edit routines.
  • Understand and use the DO, GOTO and QUIT commands to execute a routine.

Assignment of Namespaces

In general, namespaces are used to separate groups of routines from each other. It is a common practice for grouping application functionality.

Normally this course is given in a classroom environment where all students store there routines in a common directory or UCI area. Under these conditions it is extremely important to assign namespace prefixes to each student. However, since most of you are distributed you will not have to worry about it unless there are 2 more on one machine in the same area. If you are using a Paideia account, you are running as a separate instance so you do not have to worry about it.

In any event, simply assign yourself a two character prefix to be used in creating routines for this course.

Do the exercises for creating and executing a routine.

DO, GOTO, and QUIT Command

The DO command is the most common command for executing a routine or subroutine within a routine.
Perform the exercise.

What would happen if you replaced the GOTO READ with a DO READ at line READ+6? Go ahead, try it. If you don't understand why, please ask for an explanation on this topic.

Exercise

Notice that the main entry point with the label READ uses a GOTO at the end of it to perform a loop. The purpose of the loop is to iteratively ask for the first and second numbers. Change this subroutine to use the FOR command to set up the iteration loop. If you get it to work, share it with the rest of the students by publishing it on this topic.


This is the last lesson of Unit 1. Proceed to Unit 2 and read ahead. Unit 2 lessons will be published shortly.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/