I have two functions, and I am trying to use the result of one function in the second one. It's going to the else
part, but it's not printing anything for "cus_number".
How do I get the "cus_number" printed?
Function getNumber number = "423" End Function cus_number = getNumber If (IsNull(cus_number)) Then WScript.Echo "Number is null" Else WScript.Echo "cus_number : " & cus_number End If
To return a value using the Return statementPut a Return statement at the point where the procedure's task is completed. Follow the Return keyword with an expression that yields the value you want to return to the calling code. You can have more than one Return statement in the same procedure.
To return a value from a function, you must include a return statement, followed by the value to be returned, before the function's end statement. If you do not include a return statement or if you do not specify a value after the keyword return, the value returned by the function is unpredictable.
Overview. In VBScript, there are two ways values can be passed: ByVal and ByRef . Using ByVal , we can pass arguments as values whereas with the use of ByRef , we can pass arguments are references.
To return a value from a VBScript function, assign the value to the name of the function, like this:
Function getNumber getNumber = "423" End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With