Hello World

Pocket Programming Language's syntax is very easy to learn. It is simple, clean and very efficient. The syntax is a mixture of the best features of the most common programming languages like C, C++, Pascal and Basic. If you know just little bit of programming, chances are you will pickup PPL in no time.

Now it is time to write your first program in PPL. You can now show your friends that you can write programs on the PocketPC and the PC with just one source code.

Open up the PIDE (short for PPL IDE) and select File -> New. A new source code window will open. Write the following line inside that text:

ShowMessage("Hello World!");

Now let's save our program. To do this, simply select File -> Save as... Save it to C:\Program Files\PPL\Tutorials\Hello World.ppl You will have create the folder Tutorials first.

Tutorial1.png

It's time to see if we have made any errors typing this code. Select Run -> Compile. The first PPL will do is to ask you where you want to run the current program from and the location where PPL runtime has been installed. Every new file you run or compile will need this value entered the first time. If you use a project, PPL will save the locations for you in the project file, you won't have to do it again.

Tutorial2.jpg

Compiling your code first will produce a compilation report. If there are any errors, simply double-click on the line in error on the report and it will bring you right where the error occurred in your source code.

Tutorial3.png

Finally it's time to run this nice little program. Select Run -> Run. Voila you will have a nice little dialog with Hello World! in it.

Tutorial4.png

Let's now run it on the PocketPC. Go to the top right side of the PIDE in the toolbar, change the Target Device to PocketPC. Select Run -> Run, enter the default location where you want the program to run from. In this case we will use the default \My Documents\. The source code will be transfered to \My Documents\Hello World.ppl and run from there on the PocketPC.

What if we would go step further and make this Hello World program a little more sophisticated?

Change the source code to this:

proc DisplayMessage (message$)
ShowMessage (message$);
end;

proc Main
DisplayMessage ("Hello World!");
end;

This program will give you the same result but we can now see how to use procedures and pass parameters to them. Select File -> Save to save the file. Compile it, then run it.

What about the console you ask?

Let's rewrite the program again but this time, we will output the Hello World! line to the console. Change the program to the following code:

#include "console"

func WinMain
InitConsole;
ShowConsole;

Writeln ("Hello World!");

return (true);
end;

It is a little different this time. PPL needs to run in window mode since a new console window will be created. You need to return a false value to tell PPL not to free the application from memory when the function WinMain finish executing. The first line is to include the console.ppl library in our program. Next we need to initialize the console and then we display it with ShowConsole. All we need to do now is display our Hello World! line using the Writeln function.

Tutorial5.png

If you would like to review the functions and procedures of the console.ppl library, click on the console world in the #include line of your program and press SHIFT+F11 to open the console.ppl file in the editor.

So there we are. Our first tutorial, a simple program but one that works and both platforms with any modifications and that can be a good start to expand your ideas. Have fun and see you next time.