Difference between revisions of "W1040 Printing and String Interpolation"

From Coder Merlin
(Created page with "thumb|link=|Teletype == Prerequisites == * W1037 Expressions == Background == A '''teletype machine''' (or teleprinter) is an electromechanical devic...")
 
Line 4: Line 4:
== Background ==
== Background ==
A '''teletype machine''' (or teleprinter) is an electromechanical device which can be used to send and received typed messages over a distance.  It was one of the first devices which enabled the layman, not trained in Morse Code, to communicate easily with another.
A '''teletype machine''' (or teleprinter) is an electromechanical device which can be used to send and received typed messages over a distance.  It was one of the first devices which enabled the layman, not trained in Morse Code, to communicate easily with another.
In addition to processing commands to print '''printable characters''' the teletype processed '''non-printable characters'''.  The most common of these are:
; '''TAB''' : A control character (ASCII code 0x09) used to move a device's position to the next horizontal tab stop. 
; '''LINE FEED''' : A control character (ASCII code 0x0A) used to move a device's position to the next line.  Abbreviated as LF.
; '''CARRIAGE RETURN''' : A control character (ASCII code 0x0D) used to reset a device's position to the beginning of a line of text.  Abbreviated as CR.
== Introduction ==
== Introduction ==
The '''print''' function is one of the most basic functions available and is also one of the most useful.  It provides us with the ability to easily output data from our program, most often to the console.  As such, it is invaluable for both a completed programming and for assisting us to debug a program during development.
The '''print''' function is one of the most basic functions available and is also one of the most useful.  It provides us with the ability to easily output data from our program, most often to the console.  As such, it is invaluable for both a completed programming and for assisting us to debug a program during development.

Revision as of 21:05, 28 October 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Teletype

Prerequisites[edit]

Background[edit]

A teletype machine (or teleprinter) is an electromechanical device which can be used to send and received typed messages over a distance. It was one of the first devices which enabled the layman, not trained in Morse Code, to communicate easily with another.

In addition to processing commands to print printable characters the teletype processed non-printable characters. The most common of these are:

TAB
A control character (ASCII code 0x09) used to move a device's position to the next horizontal tab stop.
LINE FEED
A control character (ASCII code 0x0A) used to move a device's position to the next line. Abbreviated as LF.
CARRIAGE RETURN
A control character (ASCII code 0x0D) used to reset a device's position to the beginning of a line of text. Abbreviated as CR.

Introduction[edit]

The print function is one of the most basic functions available and is also one of the most useful. It provides us with the ability to easily output data from our program, most often to the console. As such, it is invaluable for both a completed programming and for assisting us to debug a program during development.

Basic Usage[edit]

In its most basic form, the print function takes a single argument. It's able to print integers, floating points, Booleans, and strings.

Key Concepts[edit]

Exercises[edit]

References[edit]