Basics of Functions

Print Function
The following function will print 'hello world' whenever it is called.

void HelloWorld {  print "Hello World\n" }

Because DXL doesn't require parenthesis if there is zero or one arguments, after this function has been declared it can be called by simply typing the name of the function in a line. Using a function the Hello World program could be written as follows.

void HelloWorld {  print "Hello World\n" } HelloWorld

Functions with a single argument also don't require parenthesis. This can be demonstrated with a simple modification of our HelloWorld program.

void HelloWorld(string s) { print "Hello World " s "\n" } HelloWorld "Wide Web"

This simple script will print the string "Hello World Wide Web". This also exemplifies another important feature of DXL. When next to a string, the space character is used as a concatenation operator. In this way the three strings are added together, and printed.