Custom Search
 
  

 
COMMA.When a comma is used as a separator in a PRINT statement, standard spacing (16 spaces per field) is achieved. When numbers are printed, the first space is reserved for a minus sign. A comma maybe used at the end of a PRINT statement to allow the information in the following PRINT state-ment to be printed on the same line. On some computers, when two commas (,,) are used together they will produce a blank field in printed output. Here are some examples of what commas do in a PRINT statement.

Example:

Using commas as separators

The output from this example would look like this:

You will notice the output is spaced out into three print zones or fields.

Look at the following example and see what effect a comma at the end of a PRINT statement has on the output.

Example:

Using commas at the end of PRINT statements

The output will look like this:

Here we have two PRINT statements but only one line of output. The comma at the end of line 10 caused the output from line 20 to be printed on the same line as the output from line 10 beginning in the next available print zone.

Lets see what will happen if we use two commas (,,) together in a PRINT statement. (NOTE: This may not work on some computers.)

Example:

Using two commas together

The output will look like this:

Here we have a blank field. The second data element started in the third print zone or field instead of the second, because of the two commas used together.

SEMICOLON.NOW lets examine the second punctuation mark used in PRINT statements, the semicolon. When a semicolon is used in a PRINT statement, messages are printed together without any spaces (packed spacing). However, numeric data will be printed with two spaces between each number, one space is reserved for the minus sign. Like the comma, a semicolon used at the end of a PRINT statement causes the information in the next PRINT statement to be printed on the same line. The following examples show the effect a semicolon has on a PRINT statement.

Example:

Using semicolons as separators

As seen in this output, the semicolon used as a separator in a PRINT statement causes packed spacing.

Example:

Using semicolons at the end of PRINT statements

As seen in the output from this example, the semicolons caused all the printed output to come out on the same line with the message printed together followed by the numeric data.

Some important points to remember about the PRINT statement are:

It will print any message enclosed in quotation marks.

It will print any number or variable.

It will calculate and print the result of an expression.

A blank PRINT statement will cause a blank line in your output.

When a comma is used as a separator, normal spacing (16 spaces per field) is achieved.

When a comma is used at the end of a PRINT statement, the data in the next PRINT statement is continued on the same line beginning in the next print zone.

When " " (quote, blank, quote) is used as a print field the computer will skip to the next print field. You are actually telling the computer to print a blank field. On some computers, two commas (,,) together will produce the same results.

When a semicolon is used as a separator, packed spacing is achieved.

When a semicolon is used at the end of a PRINT statement. the information contained in the next PRINT statement is continued on the same line.

PRINT statements can become awkward when many computations are to be done or the results of computations are to be used in other calculations.

The results of computations done in a PRINT statement are not stored in the computers memory; therefore, away is needed to store data or the results of computations for later use. The LET statement will do this, since computations done in a LET statement are stored in the computers memory.







Western Governors University
 


Privacy Statement - Copyright Information. - Contact Us

Integrated Publishing, Inc. - A (SDVOSB) Service Disabled Veteran Owned Small Business