week eight – thursday 19 september
lecture notes:
processing – Function()’s do things, Variables store & classify information. There are a range of different types of variables, we need to tell Processing what type of variable we are dealing with so that it knows what to do with it.
Some new variable data types to make note of are,
String – multiple characters, for example, names.
boolean – are true/false variables that can act as on/off switches, for example you would use this when you wanted specific to happen when a mouse is pressed.
array – a list of data, for example you could have an intArray, stringArray, hexArray etc.
int – Numbers, for example birthdays. these are whole or negative numbers. By defining a number as an integer processing can understand what to do with it, such as multiply, use as coordinates, divide etc..
float – Numbers that are fractions or decimals, these can also be whole numbers.
‘for’ loops
These loops allow for multiple varied functions to be carried out in a few lines of code rather than many.
for(int k = 0; k<3; k++){ function }
‘for’ is kind of like a function
‘int k = 0’ is the init, it defines the initial k value as 0.
‘k<3’ is the test, the number is the number of times the code runs, if the test is false (eg: k is more than 3) the forloop stops running.
“k++’ is the update, this describes what we want to happen each time the loop runs. ++ means add one each time, this can also be written as k = k+3, in this form the number can be substituted for whatever is needed in the context.
The variable that is defined (k in this case) can only be used within the curly brackets of the for loop.
‘for’ loop pair tasks:

















