The continue keyword is used when you wish to skip a single iteration in a loop. For example, if you
wanted to iterate an integer and display any values that are not a multiple of 3, you could do the
following:
for ( i in 0...10 )
{
if ( i % 3 == 0 )
Chapter 4: Controlling the Flow of Information
85
continue;
trace( i ); // Outputs: 1, 2, 4, 5, 7, 8
}
Functions
Functions perform the task of grouping code that is used frequently; that is to say, used more than once.
In haXe, functions provide a much more rich entity than many other object - oriented languages thanks to
the inclusion of some functional behaviors adopted from ML languages. You will be looking at the
various uses of functions in this chapter, including their more dynamic nature and how they apply to
some of the types that exist in the haXe framework.
In haXe, there are two types of functions: those used as methods of a class and those specified as a
variable type, known as local functions. The class methods can be further grouped as static functions or
instance methods, though these variations are discussed in Chapter 5 , ??? Delving Into Object - Oriented
Programming.
Pages:
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201