Académique Documents
Professionnel Documents
Culture Documents
Function GotSecret(strArgument)
Dim bolResult
If strArgument = "uncle" Then
bolResult = True
Else
bolResult = False
End If
GotSecret = bolResult
End Function
The InputBox function is used to get a string value from the user, and
that value is stored in strInput. Then, an If...Then block calls the
GotSecret() function, passing the contents of strInput as the input to the
function. The function returns either a True or False value, which determines
whether the message "That's right!" or "Nope!" is displayed.
You try it:
FUNCTION AND SUB EXERCISE
=========================
1. Declare a variable named intTest
2. Assign the value 10 to the variable intTest
3. Create a function named DoubleUp, which accepts a single input argument
The function should take its input, double it, and return the result
as the result of the function
4. Have your script pass intTest to the DoubleUp function, and then
echo the result of the function to the screen.
** Try to accomplish this exercise in exactly 6 lines of code
(not including Option Explicit, if you use that).