What are coordinates and why should I care?
Coordinates is a way of giving names to positions in a grid.
For example the position of a chess-piece can be named by giving a letter and a digit.
For example: The top left cell would be designated A1 and the top right cell H1.
In the same way can the position of a flat in a building be references by the combination of the staircase and floor numbering.
The same basic principle can be used designate cells in grids in more broad situations.
There are some conventions regarding coordinates:
The horizontal direction (left-right) is often called the x-axis and the vertical direction (up-down) is often called the y-axis.
When the coordinates of a position is given as a sequence of numbers, to put the x-coordinate before the y-coordinate. Like this: (x, y).
Let's try it out
Type the following into the the box where it says Enter source code here:
Click Check source code.
So, what is happening here?
The function fillSquare() is taking two arguments, an x-coordinate and a y-coordinate, and will fill the square at those coordinates with dark grey when called.
Note that in programming, one almost allways start counting on zero, not one.
Now, for fun, try this:
As an exercise: Write a program that draws the first letter of your name.