H
Huy Hoang
I tried to find something about this bug (or is it really a feature?),
but couldn't find anything in this group.
Here's the thing, I have the following code:
<%
option explicit
x = "hello world"
Response.Write(x)
Response.End
%>
Which of course will generate an error because variable 'x' is not
defined,
but take a look at the following code:
<%
option explicit
x = "hello world"
Response.Write(x)
Response.End
dim x
%>
You would think this will generate an error because logically-wise you
cannot refer to a variable before it is declared. But try the code
yourself, there will be no error generated.
Let's try the same with arrays:
<%
option explicit
x(0) = "hello "
x(1) = "world"
Response.Write(x(0) & x(1))
Response.End
%>
Of course, the code snippet above causes an error because just like the
first code snippet,
variable 'x' is not defined.
<%
option explicit
x(0) = "hello "
x(1) = "world"
Response.Write(x(0) & x(1))
Response.End
dim x(2)
%>
Now we declare 'x' as an array, but when running this code, ASP clearly
does not like it and returns a Type Mismatch error.
So is this a known bug or do I just have an old version of IIS?
but couldn't find anything in this group.
Here's the thing, I have the following code:
<%
option explicit
x = "hello world"
Response.Write(x)
Response.End
%>
Which of course will generate an error because variable 'x' is not
defined,
but take a look at the following code:
<%
option explicit
x = "hello world"
Response.Write(x)
Response.End
dim x
%>
You would think this will generate an error because logically-wise you
cannot refer to a variable before it is declared. But try the code
yourself, there will be no error generated.
Let's try the same with arrays:
<%
option explicit
x(0) = "hello "
x(1) = "world"
Response.Write(x(0) & x(1))
Response.End
%>
Of course, the code snippet above causes an error because just like the
first code snippet,
variable 'x' is not defined.
<%
option explicit
x(0) = "hello "
x(1) = "world"
Response.Write(x(0) & x(1))
Response.End
dim x(2)
%>
Now we declare 'x' as an array, but when running this code, ASP clearly
does not like it and returns a Type Mismatch error.
So is this a known bug or do I just have an old version of IIS?