ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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