Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Variables [7/14]

This program draws 40 circles at random positions on the screen.
[Run the program]

This program calls the function rn, twice.

This program calls two procedures: circle and sleepMs.

The difference between functions and procedures is that functions produce a value, but they don't otherwise change anything by themselves. In contrast, procedures are allowed to produce various changes, like changing the output on the display. For example, the circle procedure modifies the output by drawing a circle.

To make functions and procedures more confusing, procedures are also usually called “functions”.

The first two arguments of procedure circle are coordinates of circle's center. The third argument is circle's radius.

Exercises:

Insert a statement print x, " ", y, " || "; just above the call of procedure circle.
[Run the program]

2. Change the inserted print statement into a println statement.
[Run the program]

3. Change the inserted println statement into: println [y:30, x, " ", y, " "]; [Run the program]

4. Try changing the arguments of rn function calls to some smaller values and observe the effects. Try a few different variations in both calls of the rn function.

Loading...