Time for action – Welcoming the user on Neko & PHP

We are going to write a simple program that asks the user their name and prints a little welcome message along with the date. This program should work with the same codebase on Neko and PHP.

The following are the steps you should follow to write this program:

  1. Identify what classes you will need to print text and read from the keyboard.
  2. Identify what classes are in a platform-specific package.
  3. Add imports for those classes.
  4. Run and test.
  5. You should get the following output:
Time for action – Welcoming the user on Neko & PHP

The following is the final code you should have produced:

#if neko import neko.Lib; import neko.io.File; #elseif php import php.Lib; ...

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.