Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commenting out lines of code 2

Status
Not open for further replies.
Jul 14, 2003
116
0
0
CA
Is it possible to comment out more than one line of code in ASP/VBScript?
 
unforntunately we cannot do that but here are two ways to acheive the same thing...code found online...

Code:
<% 
    Sub doNotExecuteThisCode 
        For Each x In Request.Form 
            Response.Write x & "<br>" 
        Next 
        Response.End 
    End Sub 
%>
Code:
<% 
    ExecuteCodeBlock = FALSE 
    If ExecuteCodeBlock Then 
        For Each x In Request.Form 
            Response.Write x & "<br>" 
        Next 
        Response.End 
    End If 
%>

-DNG
 
Very useful, but the sub/end sub thing won't work in the middle of another sub. Instead of defining a false variable to make the if false, I just use "if 1 = 0". It's pretty obvious when you read the code that it is not meant to be true.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
The second is a variation on the old trick of creating a global variable at the top of your page called debug, which you set to true or false. Then in your code you just have
Code:
If debug Then
  Response.Write("Whatever")
End If
However, I always end up commenting it out so that the system isn't checking for the value when thousands (or more) of users are hitting the page. But not till the end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top