Option Explicit

Results 1 to 3 of 3

Thread: Option Explicit

  1. #1
    Join Date
    Dec 1969

    Default Option Explicit

    I&#039;m new to ASP and I&#039;m having a problem with the inclusion of <BR>&#060;% Option Explicit %&#062;<BR>If I include the line - as recommended by just about everyone - I&#039;m getting an error that looks like this <BR>Error Type:<BR>Microsoft VBScript compilation (0x800A0400)<BR>Expected statement<BR>/oldcrowweb/listing0307.asp, line 18<BR>Option Explicit<BR><BR>If I take out the Option Explicit then the page displays correctly - no other changes reqd<BR>I&#039;m running XP with IE6<BR><BR>Any clues as this seems to be a fundamental error early in my ASP career<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Option Explicit

    I think that line has to be the very first line of the script mate...try that.

  3. #3
    Join Date
    Dec 1969

    Default That's true, but also if...

    ...you include that statement you have to make sure you DIM all the variables that you need. If you miss one, you will get an error.<BR><BR>The reason why people suggest you use Option Explicit is that it helps with debugging. It&#039;s very easy to misspell a variable and then wonder why the code doesn&#039;t work. If you use Option Explicit it will alert you that the misspelled variable isn&#039;t DIMed, so you can spot it and correct it.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts