|
Global Variables
Global variables unlike Local Variables, persist throughout the
lifetime of the script, not a procedure. In other words, they last
for as long as the script is running. Let's see how they work.
<%strGlobal = "Global variables persist during the lifetime
of the script."%>
<%=strGlobal%>
<% Sub Procedure_1 ( )
strText = "'This is a text string"%>
<%=strText%>
<%=strGlobal%>
<%End Sub%>
<% Sub Procedure_2 ( )
strText = "This is another text
string"%>
<%=strText%>
<%=strGlobal%>
<%End Sub%>
<p>This is the result for the first procedure: <%Procedure_1(
)%></p>
<p>This is the result for the second procedure: <%Procedure_2
( )%></p>
<p>This is the result for the first procedure: <%Procedure_1(
)%>, again."%>
See
it in action
As you can see, it doesn't matter whether the procedures have ended
or not, the Global variable still remains - that is for as long
as the script is running.
Back
to intro 
|