ASP Q&A: Commenting Blocks in VBScript

Thursday Sep 29th 2016
Share:

The solution for commenting out multiple lines of code in VBScript.

This is the third in a series of tips being posted based on the most read posts in one of our ASP Forums. (previous Q&A)

Problem / Question:

How can a whole block of VBScript be commented out?

Solution:

Unfortunately, you cannot block comment VBScript like you can in other languages. You can comment out each line individually. Just put a single quotation mark at the start of the line you want to 'out' and do then do the same for each subsequent line.

The following shows a sample code listing with a block of code commented:

Dim a, iLen, bSpace, tmpX, tmpFull
 
iLen = Len(sText)
  For a = 1 To iLen
'    If a <> 1 Then 
'        If bSpace = True Then 
'            tmpX = UCase(mid(sText,a,1)) 
'            bSpace = False 
'        Else
'        tmpX=LCase(mid(sText,a,1))
'            If tmpX = " " Or tmpX = "'" Then bSpace = True
'        End if 
'    Else
'        tmpX = UCase(mid(sText,a,1))
'    End if 
tmpFull = tmpFull & tmpX Next ProperCase = tmpFull End Function

Based on posts by forum members Lydia, Scotty, and Xanderno

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved