EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Printing words on several lines

Here we see what the term 'line' in the printLine command means.

In this demonstration the command printLine is executed three times in a row. When you run the program, be sure to take notice that each printLine command prints its text and then creates an empty new line. In this way each printLine command starts printing on its own new line, the new line left by the prior printLine command. Without these new lines all of the text for the entire program would be printed continuously on one line with no line breaks.

You may want to change the text in the printLine commands and watch the effect on the output.

 Slow  Medium  Fast 
Click 'Run' to go.

The typewriter carriage return

The new line that printLine outputs works very much like a carriage return arm on an old-fashioned typewriter. It positions any subsequent printing down one text line and over at the left margin.

There is another way to print information. Be sure to see the article named 'Printing several times on one line' to see this other method.


A command like printLine does two things: First, it prints the text as one would expect. Second, it is said to print a 'new line'. Nothing appears on the printer when a new line is printed. However, if any more printing is done later, that printing will appear on the next line down.

As you will see, a computer language may contain a command that works like our command print, which is found in some of the following examples. The command print functions just like printLine, except it does not output a new line as its final step.

So, computer languages usually have the ability to print something and then move to a new line, or to print something and stay on the same line.

Sometimes printing a new line is called printing a 'carriage return', and sometimes it is even called printing a 'new line and carriage return'.


Here is a flowchart that shows how this program runs:


In an imaginary language, this is how this program might look:

    printLine("First line of words");
    printLine("Second line of words");
    printLine("Third line of words");


Suggested next article:

At EZ Math Movie :

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.


Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.