Print Statements

SeaTurtle has another form of output besides drawing. SeaTurtle can also output text to the Log Output window, accessible by pressing "Log Output" button in the toolbar. Text is outputted to the Log Output window using print statements.

Print Statement Syntax

The print statement is written using the PRINT keyword followed by a number or a string. A number can be any number literal, arithmetic expression, or variable. A string is literal text between double quotation mark characters. Here is an example that prints the string "The Number Ten" and the actual number 10.:

PRINT "The Number Ten"
PRINT 10

String Interpolation

SeaTurtle supports a way of combining string literals with the values of variables directly embedded in them. SeaTurtle will interpret a string that has a dollar sign ($) followed by a variable name as an interpolated string and will attempt to lookup the value of the variable and replace its name in the string. For instance the following program will print the string "5 times 2 is 10":

SET x 5
SET y 2
SET z 10
PRINT "$x times $y is $z"