name
2010-12-11
Introduction
This program asks for the user's name, and then greets the user. It demonstrates the use of read-line
to read input, and
introduces variables.
Discussion
Input
The program uses the procedure read-line
to
read input. As you will have guessed, this procedure reads one line of
input. The line is returned without the terminating newline.
Variables
This program uses a variable called name. The
expression (define name (read-line))
defines the variable
and initializes it to the value returned by read-line
. (This
also shows how to nest expressions.) Using the variable is accomplished
simply by writing the name of the variable.