code20240213.mp4
Module 4 - Functions
https://docs.google.com/document/d/10xTO_QL339uKdS3Hme8EjLpvkSPprC_zzm-mukQI8lA/edit#heading=h.gjdgxs
Agenda of this Review Session
- Review Increment Operator
- Review Loops / Nested Loops
- Review Functions
- Basic Function Definition
- Function Definition with Parameters
- Functions Definitions with Parameters and Return Values
- Review Transformations
- translate(x,y);
- rotate(radians)
- scale(scaleAmount) or scale(scaleX, scaleY) // we did not get to this, but you should try it on your own
Increment Operator
There are shortcut ways to do simple math on a variable. For instance, it is very common to add one to a variable, ie:
x=x+1; // this adds one to a variable
You can use a javascript shortcut to do the same thing:
x++; // two plusses also adds one to a variable
x—; // two minuses subtracts one from a variable (note there are two minus signs, notion.so shows it as a solid line)
There is also another shortcut that does the same thing:
x+=1; // this also adds one to a variable