ex.hlp (Topic list)
OPTION EXPLICIT Statement Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' The following examples show what happens when you use OPTION EXPLICIT and
' when you omit it from your code. Variables can be declared using COMMON,
' CONST, DEF FN, DIM, FUNCTION, REDIM, SHARED, STATIC, or SUB statements.
 
' **************************************************************************
' EXAMPLE #1: Using OPTION EXPLICIT requires that variables be declared
' before use. In this example, OPTION EXPLICIT is defined and then attempts
' to print a variable without declaring it first.
' **************************************************************************
 
 OPTION EXPLICIT
 PRINT a                        ' Since variable is not declared, error
                                ' message is generated
 
' **************************************************************************
' EXAMPLE #2: In this example, OPTION EXPLICIT is defined, the variable is
' declared, and an attempt is made to print it.
' **************************************************************************
 
 OPTION EXPLICIT
 CONST a = "True"
 PRINT a