Turing 021 — String Variables

Remember that variables can be used to represent text (called “strings” in programming context) as well as numbers. To use a string variable called “name” that is used to represent a string you need the declaration statement:

 

var name : string    % variable declation

 

To assign a value to name you use an assignment statement like:

 

name := "Joe"        % variable assignment

 

Note the use of quotation marks around the string.

Assignment

Write a program that includes two variables called "FName" and "LName". Assign your first name and last name to these variables, then print your name to the screen.

 

Save as "021.t".