How do variables work?

A gentle reminder:-
REPEAT 4 [FD 40 RT 90]  is a convenient way of coding the following instructions                  

     FD 40 RT 90
  FD 40 RT 90
  FD 40 RT 90
  FD 40 RT 90
Or FD 40 RT 90 FD 40 RT 90 FD 40 RT 90 FD 40 RT 90

Now consider the following:-
TO SQUARE :N
REPEAT 4 [FD :N RT 90]
END

What do you think this will produce on screen?
The first line is read as to square with variable N.
What do you think this means?

Try typing the procedure in and see what happens when you type in SQUARE and press RETURN.
Did you get an error message? 
Was it telling you that there are not enough inputs for SQUARE?
Type in SQUARE 40 and try to anticipate what will happen before pressing RETURN.

Try other inputs SQ 35 or  SQ 50 or SQ 92 or SQ 59.6….
What about SQ  –56?
What do you think will be drawn now?
Imagine the freedom this now gives you.
Why not experiment further exploring the idea of a variable.  Here is another procedure you might like to use:
Trace the primitives through in your mind and ask yourself what is happening.
TO SHAPE :X
REPEAT 5 [FD :X RT 72]
END
 
NOTE: – a variable can be labelled as any letter or word. You may find SIDE and ANGLE two useful words to use.