Coding: Variables and Random

Variables basically means the name that you give values. Some examples of variables are integer which are whole numbers, similar to integers are floats which are still numbers but with decimal points, booleans, strings and arrays. The first image of coding was used to show how variables work and how to use them in code. The code for random was the second thing taught, this is a type of code that will randomly generate number. I used the random code on the size, the spacing and the colour of the circle shown in the second image. To get multiple circle on the screen i needed to use a loop function for this to happened. This started with using an integer and a while functions that will keep being repeated until i have got to the integer number of circles which was 50. Using a void mouseClicked function near the bottom i was able to clear the background and a new set of random circle was displayed.

Screen Shot 2014-10-09 at 15.37.35Screen Shot 2014-10-09 at 16.23.22

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s