ASP Best Practices

Next Topic

Indentation

Indentation makes the logical structure of the code more clear.

Once again, place a script consisting of more than one line on a line below the script delimiter, blocking and indenting it two spaces. Place a single-line script on the same line as the delimiter.

Indent everything between ASP delimiters ( <% %> ) at least two spaces, except procedures (functions and subroutines).

Also indent two spaces:

  • Each break in logic

  • Nested statements and HTML elements

  • The body of a function

  • The body of a loop from its controlling code

The following examples illustrate some of the indentation rules for scripts written in either VBScript or JScript: