Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
ASP General
sub or function
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Roland Hall, post: 4368713"] in message : Problem spotted - I'm an idiot. Hardly... : Of course, when we run test1() it is updating the variable y. : : Modified code: : : <%@ Language="VBScript" %> : <% : : Option Explicit : : Dim x : : function test1(x) : x = x + 10 : test1 = x : End function : : function test2() : x = x + 1 : test2 = x : end function : : sub test0() : dim y, z : : y = x : : z = test1(y) : : response.Write "Test1.1: " & z & "<br>" : response.Write "x = " & x & "<br>" : response.Write "y = " & y & "<br>" : : z = test1(y) : : response.Write "Test1.2: " & z & "<br>" : response.Write "x = " & x & "<br>" : response.Write "y = " & y & "<br>" : : z = test2() : : response.Write "Test2.1: " & z & "<br>" : response.Write "x = " & x & "<br>" : response.Write "y = " & y & "<br>" : : z = test2() : : response.Write "Test2.2: " & z & "<br>" : response.Write "x = " & x & "<br>" : response.Write "y = " & y & "<br>" : end sub : : x = 0 : : response.Write "Pass1: <br>" : test0() : : response.Write "<br>Pass2: <br>" : test0() : %> Great example. Very helpful. Thanks. -- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - [URL]http://www.microsoft.com/technet/scriptcenter/[/URL] WSH 5.6 Documentation - [URL]http://msdn.microsoft.com/downloads/list/webdev.asp[/URL] MSDN Library - [URL]http://msdn.microsoft.com/library/default.asp[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
ASP General
sub or function
Top