Creating Programs

Unlike most DOS versions of BASIC, PB/CC requires that all executable code be contained inside a Sub or Function.  Only scanned statements (such as metastatements, constant declarations, and procedure declarations) can be placed outside of Subs and Functions.  Therefore, every PB/CC program must have either a PBMAIN or a WINMAIN function so Windows can identify where to start executing your program.  PBMAIN and WINMAIN are special functions reserved for exactly this purpose.

The following PB/DOS program:

PRINT "At the tone the time will be "; TIME$


simply needs to be placed inside a Function called PBMAIN in order to execute:


  PRINT "At the tone the time will be "; TIME$



When your program is loaded, the function PBMAIN (or WINMAIN) is executed automatically.  This is where the main code of your application should be placed.  The program stops when there are no more statements in PBMAIN, or an EXIT FUNCTION is encountered within PBMAIN.


See Also

Upgrading To PBCC

Default Variable Typing

What is a Console?

Hello, World! Example

Line numbers and Labels