Zebra0.com

alice arraysArrays: Working with lists of objects

Arrays: Working with lists of objects


Download the Alice project: array-ready.a3p

public void myFirstMethod() {
    String[] sayings = new String[] { "Ready", "Set", "Go"} ;
    for( Integer indexA = 0; indexA<sayings.length; indexA++ ) {
        this.tortoise.say( sayings[i] );
    }
    
    for( String word : sayings ) { 
       this.tortoise.say( word ); 
    }
} 

Next: An array of animals