You are not logged in.
Pages: 1
'
So there are 3 different ways of saying almost exactly the same thing
Set object = Nothing
variable = Null
variable = Empty
Not exactly the same, but they should be !
Then there is another problem that when you declare a global variable and redeclare it locally WSH will complain the variable is already used globally. But it shouldn't, a global variable that is redeclared locally should be local making the global variable inaccessible.
I noticed some always append local variables with "my"... That may be not a bad idea...
Dim variable : variable = something
Function myFunc( myVariable )
'My code here
End Function
Now I need to think out a good naming scheme to overcome these bad programming styles promoted by MS. And it gets worse, you can't declare the type of variable beforehand so you'll easily loose track of what kind of variable you're actually working with. Is it an array or a collection ?
' Abbrevations for VBScript : long : short
'
' myObject global scope : glbMyObject : MyObject
' myObject local scope : locMyObject : lMyObject
'
' myObject STRING : strMyObject : sMyObject
' myObject INTEGER : intMyObject : iMyObject
' myObject BOOLEAN : blnMyObject : bMyObject
' myObject ARRAY : arrMyObject : aMyObject
' myObject COLLECTION : colMyObject : cMyObject
' myObject OBJECT : objMyObject : oMyObject
' myObject CLASS : clsMyObject : MyObject
I haven't listed all types as I haven't used them yet... But so far, What you guys think of this ?
Last edited by Ed Dyreen (27 Dec 2012 15:16)
Offline
Heres a function IsBlank() for dealing with null/empty variables
http://ss64.com/vb/syntax-null.html
Some naming suggestions here:
http://ss64.com/vb/syntax-naming.html
An argument could be made for using the b prefix for Byte and f (flag) for boolean
Offline
Why does the IsBlank() function at ss64.com/vb/syntax-null.html have all of the Exit Functions? They are not needed with they way the function is written.
Offline
^ Good point, I've stripped them out now.
Offline
Pages: 1