This book is now obsolete Please use CSAwesome instead.

8.3. Using a For Loop to Loop Through an ArrayΒΆ

You can also use a for loop to loop through all the elements of an array. Just start the index at 0 and loop while the index is less than the length of the array.

Mixed up programs

The following method has the correct code to subtract amt from all the values in the array <b>values</b> (a field of the current object), but the code is mixed up. Drag the blocks from the left into the correct order on the right and indent them correctly. You will be told if any of the blocks are in the wrong order or not indented correctly.

You have attempted of activities on this page