Forum Discussion
karkadil
15 years agoValued Contributor
1) Because VBScript isn't a VBA, they are two different languages and you can't expect the same behavior from 2 different languages. If you need complex objects, try using Class statement. Here is documentation on VBScript
http://msdn.microsoft.com/en-us/library/t0aew7h6
2) Well, it looks like help topic isn't clear enough. The point is, that if you declare a variable outside a procedure and the usen variable with the same name inside a procedure, but without using Dim statement, then global variable will be used instead. Here is a modified example from TC help:
Dim i
Sub ChildSub
For i = 0 To 5
Log.Message("child i = " & i)
Next
End Sub
Sub ParentSub
' THIS LOOP WILL NEVER STOP, I CHECKED!
For i = 0 To 10
ChildSub
Log.Message("parent i = " & i)
Next
End Sub
http://msdn.microsoft.com/en-us/library/t0aew7h6
2) Well, it looks like help topic isn't clear enough. The point is, that if you declare a variable outside a procedure and the usen variable with the same name inside a procedure, but without using Dim statement, then global variable will be used instead. Here is a modified example from TC help:
Dim i
Sub ChildSub
For i = 0 To 5
Log.Message("child i = " & i)
Next
End Sub
Sub ParentSub
' THIS LOOP WILL NEVER STOP, I CHECKED!
For i = 0 To 10
ChildSub
Log.Message("parent i = " & i)
Next
End Sub