Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

The if Statement [5/16]

This program draws 50 discs. The smaller ones are painted red, and the bigger ones are in blue.

Exercise:

Modify this program such that the discs on the left half of the screen are painted in red, and the ones on the right half of the screen are in blue.

If you can't solve this exercise, take a peek at the solution. You don't need to solve every exercise by yourself. A lot can be learned by simply reading the solution and applying it.

Solution

	if x<480
		: mycolor = /red;

(Note: change the highlighted expression, nothing else.)

Loading...