Every piece of information in a computer program has a type. This is because you can
only do certain things with certain kinds of information. It doesn’t make sense to multiply
two strings together, for example.
The important thing about a type is the operations you can perform on something of
that type.
For now, you just need to know that any description of a command or operation 1 in
the REALbasic documentation will specify what types the arguments to the command
1. An operation is something like + or * in mathematics. The + in our program, that puts
two strings together, is another example.
or operation should be, and what type the result should be. REALbasic will show you
an error message if you try to run a program that breaks these rules.
The expression in our program uses the + symbol you are familiar with from mathematics,
but in this case it doesn’t mean addition (it does mean addition if you use it
with numbers). If you put strings1 on either side of it, when the computer evaluates
this expression, it will form a new string by putting the second string right after the
first (this is formally known as concatenating the strings). Notice that in the expression
in our program, we had to tell REALbasic which part of the program line was a string
by enclosing it in quotes. If we don’t do that, REALbasic will try to interpret that part
of the line as a command, and will produce an error when you try to run the program
(we’ll see what happens when you do that in a moment).
It is important to understand that spaces are characters just like letters and numbers. In
our example, we put a space after the comma, inside the quotes, because if we hadn’t,
the computer would have very obediently produced a result like: