Learning Haxe: Part 6: Loops

Learning Haxe

Haxe is a strongly-typed multi-paradigm programming language that also supports cross-platform compiling into many different source and byte-code languages such as ActionScript 3, JavaScript, Java, C++, C#, PHP, Python, Lua, and Node.js.


Loops

Haxe supports two forms of looping keywords: for and while.

For

Haxe does not support the C-style of for loops. All for loops follow the for… in pattern.

For the purposes of moving through a range of values, Haxe supports a range operator that defines a pattern of min…max where min is inclusive and max is exclusive.

Haxe also understands more complex data structures through functionality known as comprehension. Loop keywords can be used to move through the data entries.

While

The while keyword works on Boolean expressions in Haxe. They continue to loop until the condition is no longer true.