DEFINE Examples


Example 1:

 

The following define sets up to display an error message

 

ERR

DEFINE

"*HD,*RED,#"Error: #",*BLUE"

  

..

 

  

DISPLAY

ERR,"Invalid Area Code"

 

The above code actually compiles as:

 

  

DISPLAY

*HD,*RED,"Error: ",*BLUE,"Invalid Area Code"

 

Example 2:

 

DEFINEs also generate a new instruction name. Note that this DEFINE is continued onto 2 lines:

 

ERROR

DEFINE

"DISPLAY *HD,*RED,#"Error: #",*BLUE"

  

  

   

  

...

 

  

ERROR

"Invalid Area Code"

 

The above code compiles to the exact output as the previous example.

 

 



PL/B Language Reference DECRYPT Example DEFINED Example