In ASP Classic, a very long if statement with multiple AND
's and OR
's can become unreadable, especially if you constantly add to them.
When your code has a lot of different Queries that show relative information and use the same database statements, you may find yourself using that same connection instead of recreating it. And this is where very long IF and/or THEN statements come into play.
A typical IF Statement will look like this.
Now, let us take a look at a more complex statement.
This first code is on one single line. This is an example of what I just encountered during the development of our new website, which will be released by the end of February 2023. (Link will be provided here once it is LIVE).
So, this IF statement consists of a lot of different getType Queries.
This is broken down by line of the above IF Statement.
Making it a lot easier to work with, as we will be adding more and more Queries to this IF Statement as time goes on.
In the below IF Statement, we separated each line with an underscore _.
This information was found @ copyprogramming.com