Click 'Run' to go.
You can use both the print and printLine commands to create your output.
Using both of the commands print and printLine allows you to create expressive output. For example, suppose the depth of a swimming pool was 12 feet, and suppose that this depth was kept in a variable named d. You might want to output a sentence like:
First, you could use print to output the start of the sentence, like this:
Second, you could output the numeric value for the variable d, as:
So far all of this output is on the same line. Lastly, you could output the end of the sentence and move to the next line using printLine with code like this:
A flowchart for this demo looks like this:
The imaginary computer code for this program could look like:
print("This is "); printLine("the first line."); print("The second line "); printLine("is here.");
Suggested next article: