WHILE AND FOr loops
4.1: while and for Loops - p5.js tutorial
Code from the video
Shows how a WHILE loop simplifies drawing repeated images at different places on the screen.
ALL Loops:
- initialize a variable
- test for an exit condition
- increment variable
Shows how a FOR Loop works:
for (var x = 0; x < width; x+=50)
{
ellipse (x, 100, 25,25);
}
Questions:
How is a global variable different from a local variable?
Code from the video
Shows how a WHILE loop simplifies drawing repeated images at different places on the screen.
ALL Loops:
- initialize a variable
- test for an exit condition
- increment variable
Shows how a FOR Loop works:
for (var x = 0; x < width; x+=50)
{
ellipse (x, 100, 25,25);
}
Questions:
How is a global variable different from a local variable?