Making decisions is a key part of the function of a script. The two main methods in ASP are “IF” and “Case”.
What we are talking about here is basically “If this condition is true then do this”. The syntax is very close to this.
IF 10 > 5 THEN
response.write(“10 is more than 5”)
The condition in the above statement is the maths bit (“10 > 5”) but could just as easily be
IF name = “fred” THEN ..
These conditions have to evaluate to true, so if you want to know if something is not true then you can use “not”, as in the following example.
IF NOT name = “fred” THEN ..
Sometimes you want to do something if the condition is true and something else otherwise. We can use “ELSE” to do this.
IF this = true THEN
There is a little more we can discuss with IF but the above will give you enough flexibility for now. Another important decision making facility in ASP is the SELECT CASE.This takes a number of options a value could match plus has an ELSE to allow you to catch all other possibilities.
SELECT CASE value