Click to See Complete Forum and Search --> : VBScript function


crazyheffro
06-23-2003, 02:31 PM
I am learning ASP. I am learning VBScript to do my server-side scripts. I'm having trouble with some of the syntax.

In a function, how do you specify what variable is returned? I don't see a return statement in the stuff I'm looking at.

CrazyGaz
06-23-2003, 05:33 PM
the first function I wrote in VBscript added two strings, the syntax is.

Function addStrings(string1, string2)
addstrings = String1 & String2
End Function

then to call the function.

NewString = addStrings(1,2) ' this will return 3
NewString = addStrings("1","2") ' this will return 12

hope this helps, Gaz.

Bullschmidt
06-24-2003, 12:08 AM
And here's something more about custom functions:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtorifunctions.asp