If...Then...Else / For...Next Instructions
If....Then...Else

The If....Then...Else instructions sequence is very similar to the one we may find in different kind of scripting languages. Let's check an example.
 

<% 
AA="water"

If AA="water" Then
 response.write ("I want to drink water")
Else
 response.write ("I want to drink milk")

End If
%>

We may use it this way:

<%  AA="water"
If AA="water" Then %>

       I want to drink water

<% Else %>

       I want to drink milk

<% End If %>

In both cases we have checked a condition (AA="water"), and we have get a positive instruction (to write the sentence "I want to drink water"). We are allowed to execute any kind of instructions (including  If....then....Else) and as many instructions as we want .
 

For....Next

This instructions is also similar in different programming languages. Let's see a typical example.
 

example.asp
I want to say "Hello" 10 times<BR>
<% For mynumber = 1 to 10 %>
<% =mynumber %> Hello<BR>
<% Next %>
END

In this case we have defined a variable ("mynumber") and using the For...Next instruction we have repeated 10 times line 4. Similarly to If....Then....Else instruction, we are allowed to execute any kind of instructions and as many of them as we want .

The For...Next instruction allows to define the value of the increment.
 

<% For mynumber = 1 to 20 STEP 2
response.write("Hello<BR>")
Next %>
<% For mynumber = 20 to 1 STEP -2
response.write("Hello<BR>")
Next %>

In both cases we will get the same response ("Hello" 10 times). The increment may be positive or negative as shown in the example.









   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML