First Call TypeName ( ) Function

Din lngAge
lngAge = InputBox("Plese enter your age in years")
MsgBox "TypeName After InputBox: " & TypeName(lngAge)
If IsNumeric(lngAge) Then
lngAge = lngAge + 50
MsgBox "TypeName after Adding 50: " &TypeName(lngAge)
MsgBox "In 50 years you will be " & lngAge & "years old."
MsgBox "Sorry, but you did not enter a valid number."
End If

The first call to the TypeName ( ) function shows that the subtype is String. That is because data coming back form the InputBox function is always treated as String data, even when the user types in a number. Remember that the String subtype can hold just about any kind of data. However, when number and dates and Boolean True/False values are stored in a variable with the String subtype, they are not treated simple as strings of text with no special meaning. This is why, when our code tries to do math on the String value, VBScript must first coere the subtype to a numeric one.