Hello, World! Example

Every programmer is familiar with the "Hello, World!" program.  It simply displays the greeting text to an end user.  While not a significant program, it does measure two important things.  The amount of source it takes to write a complete application and the size of the executable generated by a compiler.

In Visual Basic, you have to create a form with a static text label and write the code to change the label.  You then have to set the text of the label.  Finally, you have to access several different menu items and property sheets, in order to configure VB to compile a true EXE as small as it possibly can.  The result?  1.9 Megabytes of executable and run-time DLLs.

In PB/CC, only three lines of code are necessary:

FUNCTION PBMAIN

  PRINT "Hello, World!"

END FUNCTION

And the PB/CC compiler takes care of the rest automatically.  No separate steps for linking are necessary.  Save the above code as "hello.bas", and at a command prompt (DOS prompt), simply type:

PBCC hello.bas

You're done!  You can now run the 7 Kb executable which will greet you enthusiastically.

 

See Also

Writing Programs in PBCC

Creating Programs

Line numbers and Labels