Basic HTML version of Foils prepared
October 30 1999
Foil 10 Arrays and For Loops
From
Short Introduction to Kids on Basic Programming Concepts in Java Sonia Kovalesky festival workshop (High School Girls) --
October 23 1999
.
by
Nancy McCracken
1
To assign or use all the elements of an array in order, a "for" loop is handy.
2
int max = 8;
3
int numbers [ ] = new int [ max ] ;
4
for ( int i = 0; i < numbers.length; i++ )
5
{
6
numbers [ i ]= i * 2;
7
}
8
0 1 2 3 4 5 6 7
9
0 2 4 6 8 10 12 14
in Table To:
©
Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu
If you have any comments about this server, send e-mail to
webmaster@npac.syr.edu
.
Page produced by
wwwfoil
on Sat Oct 30 1999