Variable scope and lifetime


Joined
Jul 9, 2012
Messages
24
Reaction score
0
I seem to be confused by these two concepts.

Code:
Dim a As Integer
 
Sub Firstproc
 
a = 10
 
Call Secondproc
 
End Sub
 
Sub SecondProc
 
Dim b as Integer
 
b = a
 
End Sub

As a is declared at the module level, Secondproc can "read" it.

This is an example of scope but what is lifetime?

Thanks
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top