Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
ASP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Server Variables
Creating Login Page
E-mail
ASP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing

ASP If Statements

Using if statement, ASP has the ability to make distinctions between different possibilities. For example, you might have a script that checks if a variable consists certain type of values.

Here is syntax for asp if statement.
<%
if condition is true then
   do something
else
    do something else
end if
%>

Check the following if statement that checks if a variable has a value equal to 1.
<%
dim n
n =1
if n= 1 then
    response.write("N has the value equal to 1")    
else
    response.write("N is not equal to one")
end if
%>

Nested If Statement

You would be able to check variety of conditions based on deversified values.  

The following example is nested if statement to check two conditions:
<%
dim fruit1, fruit2, in_store
fruit1="Apple"
fruit2="Orange"
in_store=1
if in_store=1 then
%>
   <%=fruit1%> is in store
<%
else if in_store=2 then
%>
   <%=fruit2%> is in store
<%
else
   response.write("No value specified")
end if
%>
This if statement will check if the variable in_store is equal either 1 or 2 and displays fruit1 or fruit2 according to the true condition.  <%=fruit1%> will display the value of the specified variable.   It's similar to response.write(fruit1).  

Sub Procedures Case statement
Listed @ ConsumerVote.com - The Consumer Rated Web Directory
PC Articles
  Computer Safety
prevent viruses & Spyware