Functions in VBScript



A function is exactly the same thing as a procedure except that it returns a value.

<HEAD>

<SCRIPT LANGUAGE="VBScript">
<!--
Function Squared (x)
	Squared = x * x
End Function
-->
</SCRIPT>

</HEAD>

<BODY>

<SCRIPT LANGUAGE="VBScript">
<!--
document.write "The square of 2 is " & Squared (2) & ".<BR>"
document.write "The square of 4 is " & Squared (4) & "."
-->
</SCRIPT>