A variable is a name for a remembered value.
You can create your own variables using
=. You need to
define your variables before you can ask the comptuer to
Once you have defined a variable, you can refer to the value by name anywhere in your program.
x = 2.875 write x * x * x
The single equals
= assigns or changes a variable value.
Be sure to not try to use
= to test equality, because it
will change your variable instead of testing it. Tests
are done with
A variable can also remember any word or other sequence of characters, called a string.
song = "GEC" write song play song + song
song is a name for the sequence of letters
song is unquoted and
"CEG" is quoted.
If we wanted to literally write the word "song", then we would
have had to use quotes:
A quoted value is called a literal value: it should not be confused with a variable name, which is unquoted.
It is best to avoid using these names for your own variables, because when you redefine these variables, their built-in meaning may become unavailable in your program.