Haxe Code Cookbook
Haxe programming cookbookBeginner

Beginner

Overview of Haxe beginner snippets and tutorials.

  • Oct 13, 2016 Beginner /

     array collections data-structures

    In Haxe, the Array type represents a collection of elements ordered by their index (order number) in the collection.

  • Apr 25, 2016 Beginner /

     conditional-compilation

    This snippet demonstrates use of conditional compilation with custom compiler flags.

  • May 09, 2017 Beginner /

     date time

    The Date class provides a basic structure for date and time related information. This article shows how to work with the date and time tools.

  • Apr 04, 2016 Beginner /

     class

    Create a new class with two functions and create a new instance of it.

  • Jun 24, 2020 Beginner /

     class

    As an alternative to the traditional way of instantiating classes using the new keyword - which is how it's done in most object oriented languages such as Java or C# - you can use the @:structInit metadata when you declare the class.

  • Apr 04, 2016 Beginner /

     class

    Declare function with arguments

  • Oct 30, 2016 Beginner /

     enum data-structures

    Haxe's enumeration types are algebraic data types. Their primary use is for describing data structures.

  • Jun 17, 2019 Beginner /

     emscripten

    This is a hello world example which will be compiled and linked to Emscripten.

  • Mar 26, 2016 Beginner /

    This tutorial demonstrates how to write and compile a Hello World Haxe program. It explains the involved file-format (.hx) and gives a basic explanation of what the Haxe Compiler does with them.

  • Oct 13, 2016 Beginner /

     collections data-structures

    In Haxe, the List type represents a linked-list of elements.

  • Feb 27, 2017 Beginner /

    This example uses haxe.Http to load external json file using and demonstrates how to handle the result.

  • Dec 15, 2016 Beginner /

     collections data-structures

    In Haxe, Map (also known as dictionary) allows key to value mapping for arbitrary value types and many key types.

  • Sep 29, 2016 Beginner /

     math

    Define integers and floats:

  • Aug 31, 2017 Beginner /

     enum pattern-matching data-structures

    This article helps to learn pattern matching and all of its type of matching in practice. The article covers basic matching, variable capture, guards, extractors and enum/structure matching.

  • Jan 23, 2018 Beginner /

     reflection dead-code-elimination

    To invoke method by it's name you will need to use Reflection API.

  • Sep 23, 2016 Beginner /

     ereg

    In Haxe a regular expression starts with ~/ and ends with a single / and is of type EReg.

  • Aug 16, 2019 Beginner /

     io

    Reading from stdin and writing to stdout and stderr.

  • Oct 20, 2016 Beginner /

     reflection dead-code-elimination

    This snippet shows how to use a string as a variable identifier using reflection.

  • Jul 11, 2017 Beginner /

    Defining string literals take be done by wrapping text inside double or single quotes:

  • Mar 26, 2016 Beginner /

     filesystem

    Using file system in Haxe is made easy because of the sys package. These are the Haxe targets that can directly access the filesystem:

  • Apr 29, 2016 Beginner /

     static-extension modules

    The concept of static extensions is a very powerful concept that gives the possibility of keeping types and objects lightweight, and extending them with functionality only when actually needed. Here we will have a look at how some commonly used methods for basic types are implemented as extension methods, and how you can write your own.