Shapes

Statements

A program is made of statements. A statement ends in a semi-colon (;). The statement below calls an ellipse-function, wich draws an ellipse:

ellipse(20, 50, 10, 40);

Some functions need parameters. Ellipse-function needs four parameters. First and second parameter set the x and y coordinate, third and fourth parameter set the width and height of the ellipse. Parameters are separated by comma (,).

             parameters      
                 |           
function name    |           
     |           |           
     |           |           
     |    /------+-----\     
  ellipse(20, 50, 10, 40);   
          |   |   |    |     
          x   y  width |     
                       |     
                     height  

Let’s draw some shapes!

Try the example in the editor below. Can you draw a circle with the ellipse-function?

Reference
ellipse
rect