this is a series of vbscript statements enclosed


This is a series of VBScript statements enclosed through the Function & End Function statements. A Function procedure is same to a Sub procedure, however can also return a value. This can take arguments (variables, constants or expressions which are passed to it by a calling process). If a Function procedure has no arguments, its Function statement has to comprise an empty set of parentheses (). A Function returns a value through assigning a value to its name in one or more statements of the process. The return type of a Function is always a Variant.

In the given example, the Celsius function calculates degrees Celsius from degrees Fahrenheit. While the function is called from the ConvertTemp Sub procedure, a variable having the argument value is passed to the function. The result of calculation is returned to the calling process and displayed in a message box.

Sub ConvertTemp()

temp = InputBox("Please enter the temperature in degrees F.", 1)

MsgBox "The temperature is " & Celsius(temp) & " degrees C."

End Sub

Function Celsius(fDegrees)

Celsius = (fDegrees - 32) * 5 / 9

End Function

Request for Solution File

Ask an Expert for Answer!!
Visual Basic Programming: this is a series of vbscript statements enclosed
Reference No:- TGS0265917

Expected delivery within 24 Hours