The default Display Window has dimensions 100 pixels in width by 100 pixels in height and it is automatically created when we run a sketch.
The size() function.
The size() function allows you to specify the dimensions of the Display Window in pixels. You use the size() function by supplying two parameters to it, a width value which defines the horizontal dimension of the Display Window and a height value which defines the vertical dimension of the Display Window. Just like the println() function, parameters for the size() function are entered between the function's parenthesis. For example if we wanted the dimension of the Display Window to be 640 pixels across by 480 pixels down we would type:
Note that because we have just entered a statement telling Processing how big we want the Display Window to be we must terminate this statement with a semi-colon. You might also have noted that the two values 640 and 480 are separated with a comma. Do not try to separate parameter values such as these with a semi-colon because the statement is incomplete at that point and you are therefore attempting to terminate it prematurely. This will most commonly result in a syntax error or even worse in a logical error in some cases. Parenthesis following a function's name is usually reserved for parameters relating to the function and these parameters are most commonly separated by commas. This is pretty easy to remember because in English you generally list items by separating them with a comma in Processing and many other higher level languages you separate parameter values for a function with a comma. The two values 640 and 480 have been “listed” in this particular order because when Processing accepts parameters of dimensional type like X and Y or width and height in 2 dimensions, or X, Y and Z or width, height and depth in 3 dimensions it will generally accept values in the order X or width first, Y or height second and Z or depth third. This is with the exception of a trigonometric function called atan2() in which Y is read first followed by X due to the special circumstances of how this function works. Incidentally many other programming languages besides Processing accept parameters in that particular order for the atan2() function and in the standard format of X, Y, Z or width, height, depth for most other functions. Below the first statement type the second statement so that your code now reads:
println("Hello World"); size(640,480);