In order to draw figures on the screen, you do not need to worry about individual pixels or the particular algorithm used to make drawings on the screen. All of these details have been encapsulated into the predefined turtle graphics functions. In order to draw a square, you need simply make the appropriate calls to these functions. In order to draw a square with sides of length 60, you must change the argument in each of the calls to forward . A square of any particular size requires its own version of this code, with the only difference being the number supplied as the argument to forward .
Variables allow for an additional level of abstraction.
For example, the following JavaScript code can be executed to draw a square with sides of length 50. By changing the value in the assignment, you can change the length of the sides and thus the size of the resulting square. If you wished to draw several squares on the screen, you would need a separate copy of the code for each square drawn. A better solution would be to define a new abstraction for drawing squares. The following JavaScript function definition encapsulates the square drawing code above into such a function.