Learning Haxe: Part 4: Conditional Statements

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.


Conditional Statements

Haxe supports comparing two value using multiple operators.

  • ==: Equal
  • !=: Not equal
  • <: Less than
  • >: Greater than
  • >=: Greater than or equal to
  • <=: Less than or equal to

When using pairs of comparisons, Haxe also supports binary, logical operators.

  • &&: Logical AND
  • ||: Logical OR
  • !: Logical NOT

Syntax

Conditional statements start with an initial keyword of if and enclose their comparisons within parentheses. The code to run as a result is within open and closing curly brackets.

If… else if

Haxe supports the if.. else if pattern where an additional if-statement can be paired at the end.