|
|
| Documenting scripts and source code |
| Written by Bill Slark | |
| Thursday, 20 January 2005 | |
|
How to keep track of changes within your scripts and source code. When writing applications, it is always useful to be able to look back at exactly what each line of code does as quickly as possible. Here's how to do it... When writing applications or scripting useful functions, it is always helpful to document the code as you go along so that, should you ever need to tweak the code, you'll know exactly what each line of code does at a glance. Fortunately Microsoft have very kindly standardised on the line header REM which then renders everything after that keyword as a comment for instance: REM This loop acts a counter REM set the initial count value to 0 i=0 REM set up a loop that executes until the counter value reaches 10 do while i <= 10 REM write to screen the current value of the counter Response.Write "i currently equals: " & i & "<br>" REM add one to the value of the counter i = i + 1 REM Restart the loop until the counter is equal to 10 loop REM End the loop As you can see, by using REM I can tell myself or another technician modifying this script exactly what each line of code does and why. Useful! I document the whole of my Cisco network in this way! |
|
|