Let me just start by saying that I despise ASP Classic / VB Script syntax more than anything ever created. Honestly, I'd rather program in Whitespace (http://en.wikipedia.org/wiki/Whitespace_(programming_language)
Now onto the problem. I have an include file that I want to include across multiple pages. It uses a variable from another include file that the user MAY OR MAY NOT have already included. One, both, or neither of the includes can show up on any of my sites pages, so I can't just move the variable between files (unfortunately).
In a decent language, I could use something like a header guard to prevent compilation errors, but VB Script has no such capacity. I don't even really care if the file is included directly, just that this one particular variable exists. I thought about something like this in the include:
If Not myVariable Then
Dim myVariable = "This is my variable"
But because of scope, that myVariable declaration won't be seen by the rest of the page. That kind of defeats the purpose.
In simple terms my task is: Check if a variable is already defined. If it is, do nothing. If it isn't, define (Dim) it.