beautypg.com

Apple IIe User Manual

Page 31

background image

Page 31 of 74

IIe
Printed: Tuesday, March 4, 2003 10:40:15 AM

1

PRINT ROSES ARE PINK

Now type RUN.
Notice that your new line 1 replaces your old line 1, but all the other lines remain the same.

Erasing Statements:

To erase a whole line, just type the line number without a statement. For example, to get rid
of the line VIOLETS ARE BLUE, you'd type 2 with no text following it, then press Return.

Inserting Statements

Suppose you wanted to insert a PRINT statement between line 1 and 2? You'd be out of luck.
You'd have to renumber every line in your program because there's no room between lines 1 and
2.

That's why it's considered good programming practice to number your program by tens (10,

20, 30 instead of 1, 2, 3).

That way there's room for you to insert anything you find you've

left out in the first go-round.

The LIST Statement

Suppose you want to look at all the program statements after you've typed them into memory?
You can do it using the LIST statement.

The LIST statement shows all the program lines in memory in numerical order.

Even if you

originally typed them starting with line 4 and ending with line 1, they'll

appear in order

when you type the LIST command.

Type LIST.
Is That All There Is?
The PRINT statement is pretty straightforward, but by itself it doesn't do much for you.

If

all you wanted to do was type sentences on the screen, you'd use a word processing program, not
a bunch of PRINT statements.

The PRINT statement is only powerful when you use it in

conjunction with other statements like INPUT and LET.

Before you learn about INPUT and LET, erase your first program from memory.
Type NEW

Don't Worry:

Before you learn to write long and useful programs, you'll learn how to save them on disks so
they won't be lost when you erase them from memory.

Variables

Remember how that first disk you used asked for your name, then used it, like an old friend, on
every possible occasion?

That little trick was done with variables.

Variables are place

holders letters or words that hold a place for some piece of information that the person using
the program will provide.

The programmer who wrote that program didn't know what your name would be, so he assigned a
variable to that piece of information and used the variable every time he wanted the program to
use your name.

Once he tricked you into revealing your name, he told the program to take that input (your
name) and use it in place of the variable throughout the program.
So how do you tell the computer that you want to replace a certain variable with a name or
other input?

One way is to use an INPUT statement.

Here's how it works.

The program asks a