| << 9.3.2- Comment Your Code | Chapter9 | 9.3.4- Use Subprocedures >> |
Use Option Explicit
Back in Chapter 4 we mentioned this, and it really is worth using – especially if your typing is as bad as mine! If you remember, it justforces you to declare all of your variables before you use them, and it willforce an error to be generated if you use a variable that hasn't been declared.
It's simple to use. For server-side script, just put thefollowing line at the beginning of your ASP file, following the language andbuffer tags:
<% Option Explicit %>
For client-side script you can add it at the beginning ofthe script:
<SCRIPT LANGUAGE=VBScript>
Option Explicit
. . .
</SCRIPT>
That's all there is to it, and it saves a lot of timehunting for those little typing mistakes. One thing to remember is that onceyou've completed your debugging and removed all of the typos, then you canremove Option Explicit;otherwise it may slow down your server.
| << 9.3.2- Comment Your Code | Chapter9 | 9.3.4- Use Subprocedures >> |

RSS

