BrainDump
  Home arrow BrainDump arrow Page 3 - VBScript: Multidimensional Arrays, Stateme...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

VBScript: Multidimensional Arrays, Statements, and Commenting
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-12-10

    Table of Contents:
  • VBScript: Multidimensional Arrays, Statements, and Commenting
  • Dynamic Arrays
  • Conditional Statements
  • If...Then...Elseif
  • The Select Case
  • Commenting Your Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    VBScript: Multidimensional Arrays, Statements, and Commenting - Conditional Statements


    (Page 3 of 6 )

    Just like other programming languages, VBScript has Conditional Statements. In their simplest form, these work on the following basis: if this is true, do that. VBScript has three conditional statements, starting with the...

    If Statement

    As stated above, the If Statement says: if this is true, do that. A real life example would be: "If mom yells that my Star Wars Spaghetti-Os are finished cooking, leave my super cool basement nerd pad to eat them."

    Here it is in some code:


    <html>

    <body>

    <script type="text/vbscript">

    Dim sitcom

    sitcom = "ALF"

    If sitcom = "Alf" Then

    document.write("Don't eat my cat!")

    End If

    </script>

    </body>

    </html>

    The above code created a variable named sitcom and assigns it the value "Alf." It then performs an If statement that says if the value of sitcom is Alf, then print out some text. If the value of sitcom had not been Alf, nothing would have happened. Since the criteria was met however, this would be the result:

      Don't eat my cat!

    That's all fine and dandy if the criteria is met, but what if it wasn't? What if we wanted to respond if the value of sitcom had not been Alf? For that we would use the Else Clause.

    You Better or....Else

    When people say that it's never a good thing. No one ever says things like "You better clean your room or else I will do it for you while you eat these warm brownies I just baked." Instead its always stuff like "You better quit calling me, sending me notes, and hiding in the bushes outside my window with those binoculars or I will inform the police that you are not following the restraining order I had to put on you because you couldn't handle that I left you for your cousin Tina at your seventeenth birthday party." Women...

    Here is some code showing the Else clause at work:

    <html>

    <body>

    <script type="text/vbscript">

    Dim sitcom

    sitcom = "Mister Belvedere"

    If sitcom = "Alf" Then

    document.write("Don't eat my cat!")

    Else

    document.write("Hey change the channel, Alf is on!")

    End If

    </script>

    </body>

    </html>

    The above code creates the variable sitcom and adds the value, "Mister Belvedere." It then creates an If statement that asks if the value of sitcom is "Alf." If it is, it will print: Don't eat my cat! to the screen. If not, will print the following:

      Hey change the channel, Alf is on!

    More BrainDump Articles
    More By James Payne


       · Thanks once more for dropping by to read my article. Here we discuss Arrays,...
     

    BRAINDUMP ARTICLES

    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics
    - Microsoft Surface
    - Making Your First Active X Control in Visual...
    - Codes and Packages in Microsoft Project 2007
    - Windows 7: Rumors and Demos
    - XP SP3 Why Me?
    - Breaking Up Your Work in Microsoft Project
    - Breaking Work into Task-Sized Chunks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT