![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
The keyword instruction EXPOSE
To give a subroutine using the keyword <PROCEDURE access to more than one
global variable, you can use the keyword <EXPOSE with a variable list in
parenthesis. Be aware, however, that in this case the variable containing
the names of the exposed variables is also exposed! This is WAD, but
poorly documented in the online help. (see also The keyword instruction
PROCEDURE and EXPOSE does not work as expected)
Example:
/* sample program to show a side effect of the EXPOSE keyword */
varA = 1
varB = 2
exposeVars = "VarA VarB"
say "Variable values before calling test:"
say " varA is " || varA
say " varB is " || varB
say " exposeVars is " || exposeVars
say
say "Now calling the sub routine test ..."
call test
say "Variable values after calling test:"
say " varA is " || varA
say " varB is " || varB
say " exposeVars is " || exposeVars
return
test: PROCEDURE expose (exposeVars)
say " -----------------------------------------------------------"
say " Now the sub routine test is activ ..."
say ""
say " test is declared as "
say " test: PROCEDURE expose (exposeVars)"
say ""
say " The values of the known global variables are:"
say " varA is " || varA
say " varB is " || varB
say " exposeVars is " || exposeVars
say " Now changing exposeVars to ""VarC VarD"" inside of ""test"" ..."
exposeVars = "VarC VarD"
say ""
say " ... the routine ""test"" ends here"
say " -----------------------------------------------------------"
return
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs