ID : 5063
Declarative Part of Program
Declarative part of program is a program code which is a part of non-procedure.
Mainly, it describes declaration statement of variable and preprocessor code. It cannot describe statement other than declaration statement.
Local variable declared in declarative part can be accessed from any procedures in the task (program file).
In the following example, local variables "aaa" and "ccc" are described in the declarative part.
<Program name: Pro1>
Dim aaa As Integer
Sub Main
Dim bbb As Integer
End Sub
Dim ccc As Integer
Sub test
Dim ddd As Integer
End Sub
Function eee(ByVal fff As Integer) As Integer
eee = fff * 2
End Function
In the example above, variable "ccc" cannot be accessed by procedure "Main."
Related Terms
Declaration Statement, Local Variable, Valid Range of Local Variable
ID : 5063