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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error In If Statement?

Status
Not open for further replies.

Moebius01

Programmer
Oct 27, 2000
309
US
Ok, first off I've never had any asp/vbscript training, just go on what I picked up by hand, so if this is standard, it's just one I never encountered before.

Will having a comment in the middle of an IF statement (before the THEN) cause an error? This was the original code.

Code:
If (args.Step = 0 Or args.Step = 1) And _
 (args.TemplateID = 501 Or args.TemplateID = 502) And _
  argsToStep > args.Step Then

I didn't need one layer of testing it did, so I commented the line out as follows

Code:
If (args.Step = 0 Or args.Step = 1) And _
'Template Check not needed (args.TemplateID = 501 Or args.TemplateID = 502) And _ 
  argsToStep > args.Step Then

But when the code was executed, it threw a syntax error. Is there something else I'm missing, or is it that you just can't have a comment in the middle of the IF statement like that?
 
You are right in saying you can't have a comment in the middle of an IF statement where you have it.

You would be interrupting the middle of a statement like that.



[monkey][snake] <.
 
Gotcha, thanks. I rather assumed the code would simply ignore the commented line completely in a case like this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top