' GLOBAL.BAS
' This program demonstrates the use of a global variable.

DECLARE SUB AddGame ()     ' declare AddGame subprogram

COMMON SHARED game$        ' declare game$ as a global variable

game$ = "Chess"            ' initialize game$ with value of "Chess"

CLS

PRINT "      In the main program, game$ = "; game$ ' display in main prog.

AddGame                                            ' display in subprogram

PRINT " Back in the main program, game$ = "; game$ ' display in main prog.

END

SUB AddGame

game$ = game$ + " and backgammon"

PRINT "In the AddGame subprogram, game$ = "; game$

END SUB

