FIT100
Arrays and Loops
Loops and arrays work together
•Declare an array and initialize elements to 4
•var j, A = new Array(5);
•for (j=0; j<5; i++) {
• A[i] = 4;
•}
•WFI and array’s indices both start at 0
•Notice what would change to have 1000 elements -- arrays and loops give power
Five elements: A[0], A[1], A[2], A[3] & A[4]