EZ Math Movie, Tutorials, Printing, Printing Text


Print text with print.

Words can be printed with the command print. The words need to be placed within quotes. We will use single quotes, although double quotes also work. Here is how to print one word:

print('mathematics'); // single quotes
print("mathematics"); // double quotes

Here is how to print a whole sentence, all at once:

print('Mathematics is fun!');

Multiple printings appear on the same line.

If you use the command print twice or more, all of the output is printed on the same line on the printer. For example, these two lines of code:

print('Hello');
print(' world.')

Would print both words on the same line. So, the output would look like this:

Hello world.

Note that we printed a space before the word 'world'. This provides the necessary space between words when they are all printed on the same line.

Values can be printed this way.

You can print values with print. The values will not be rounded when you print this way, however. Do not use quotes when using print with values, as in:

print(3.1415926535897932384626433832795);

This will print a lot of decimals and look something like:

3.141592653589793

While if you use printNumber:

printNumber(3.1415926535897932384626433832795);

You get:

3.14

Running the example program

The example program shows how the command print outputs on the same line when used repeatedly. Again, note that spaces must be printed so that they appear between the words.

Again, we use the command printNewLine before it is covered in the next tutorial. Hopefully, its operation is easy to understand. It is the way that you get off of a line of printing, since the print and printNumber commands alone will never do that.

The program also demonstrates the command's output when printing values. It is usually better to use printNumber for that, though.


The example program

0ptions
Angle measurement: Degrees Radians

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide


		

	


		

	


		

	

And....

Next tutorial: Printing a new line

 

Here are some links to related articles at EZ Programing Demos:

Printing words

Printing words on several lines

Printing several times on one line


All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.



Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com




EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com



Custom Search

Name:
Domain:

Name
0


Name:
Name
0