Time for action – Managing a fridge

We are going to create software to manage a fridge. We want to be able to add meals inside it, and to list what is in it. Ok, let's start!

  1. Create a folder that is going to hold your project's files.
  2. Create two folders inside it: a src folder and a bin folder.
  3. In your src folder, create a MyFridge folder. This way, we now have a MyFridge package.
  4. In the MyFridge package, create a Fridge.hx file with the following code inside it:
    package MyFridge;
    class Fridge
    {
       public static var meals = new List<Meals>();
    }
  5. This way, our fridge will hold a list of meals inside it. We can make this variable static because we will only have one fridge.
  6. Now, in the MyFridge package, create a file named Meal.hx and write the following ...

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.