Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return value from a VBScript function

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 
like image 539
Jill448 Avatar asked Mar 27 '13 19:03

Jill448


People also ask

How can I return a value from a function in VB net?

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.

How do you get the value returned from a function?

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.

How do I pass a value from one function to another in VBScript?

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.


1 Answers

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 
like image 134
RichieHindle Avatar answered Sep 28 '22 03:09

RichieHindle