XmlPL By Example: Hello World!, Classic

This is the classic Hello World program in XmlPL.

Steps

  1. Create Main Function
  2. Print Hello World!
  3. Compile & Run

1. Create Main Function

Like many languages, C, C++ and Java to name a few, XmlPL programs start with a call to function main. There are several allowed functions signatures for main here we will use one of them.

string[] main() {
}

This code declares that main will output a stream of strings and has no arguments.

2. Print Hello World!

In the previous step we declared that main would output a string of streams. In XmlPL the default behavior is to output to the current stream.

string[] main() {
  "Hello World!\n";
}

By adding the string expression the program is complete. \n is standard notation for the end of line character.

3. Compile & Run

The following commands will compile and execute the program.

$ xmlplcc hello.xpl
$ ./hello