set( ???one???, ???doh??? );
myHash.set( ???two???, ???ray??? );
myHash.set( ???three???, ???me??? );
for ( i in myHash.keys() )
{
myHash.set( i, myHash.get( i ) + ???#??? );
trace( myHash.get( i ) );
}
trace( myHash.get( ???one??? ) );
// Outputs: doh#
Break and Continue
There are two special keywords for use with both the while and for loops. These are break and
continue .
You use break when you want to exit a loop and continue with the rest of your application. For
example, when using a for loop, you may decide to include an extra contingency that will cause the
loop to end for the benefit of certain business logic or to avoid possible errors:
var myArray1 = [1,2,3,4];
var myArray2 = [10,9,8];
for ( i in 0...myArray1.length )
{
if ( myArray2.length < = i ) break;
trace( myArray1[i] + ??? ??? + myArray2[i] );
}
Here, the length of myArray2 is compared with the iterated value to guarantee that a value exists in the
Array for display, as only one Array can be used to initiate the loop. If, at any time, the iterated value
exceeds the number of items in the second Array, the loop is forced to exit and the application continues
as normal.
Pages:
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200