An Introduction to Dragon/Lessons/HelloWorld

Hello World
The following program prints the "Hello World" message on the screen (std-out).

Run the program
To run the program, save the code in a file (for example: hello.dgn), then from the command line or terminal, run it using the Dragon Interpreter:

Multi-Line literals
Using Dragon we can write multi-line literals, as in this example:

You can write showln to append a newline to the output:

Getting Input
You can get input from the user using the readln method:

No Explicit End For Statements
You don't need to use ';' or ENTER to separate statements. Some lines in the previous program that were separate can be combined on one line:

Writing Comments
We can write single-line comments and multi-line comments.

The single-line comment starts with //

Multi-line comments are written between /* and */