PDA

View Full Version : Function(&Sub) no result passes first run



mototrance
06-15-2007, 09:54 PM
Has anyone had a Function and/or Sub to produce a result, yet not pass that result to an outside-the-Function variable the first time it is ran?

I response.write in various places inside-the-Function and it operates perfectly; but every time it is ran for the first time the result is erased:

<%
Function sayHello(plugin)
if 1=plugin then functionVariable="Hello there."
if 2=plugin then functionVariable="What's up dude?"
End Function
sayHello 1
savedMsg1=functionVariable
sayHello 2
savedMsg2=functionVariable
%>
<p><%=savedMsg1%></p>
<p><%=savedMsg2%></p>

The first paragraph is always <p></p> in View Source, while savedMsg2,3,4,5,etc. is fine the way it should be. And, if I change to a Sub and then Call sayHello (1) the same thing happens.

Very confused.