1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 6 - Using Decision Structures - Part 1

By , About.com Guide

5 of 6

Decision Structure Syntax - How to read Microsoft documentation

If-Then-Else syntax

If-Then-Else syntax

Most tutorials don't spend much time on it, but one of the critical skills in programming is the ability to quickly read and understand the documentation available from software vendors - especially Microsoft. The book has a good example of If-Then-Else and Select Case, including the important concept of "short-circuiting" a decision - a new feature of VB.NET that was borrowed from languages like C and C++. Click the link to read my article on the same subject, VB.NET New Logical Operators.

But the book doesn't present the same view of the syntax that you'll find at Microsoft. The first decision structure explained is the If-Then-Else structure . (It's just called If-Then in the book - but I like this more complete name.) The syntax diagram you will see at Microsoft looks like the illustration shown. This diagram will tell you just how to write the statement if you know how to understand it. Lets look at the main features now.

Notice how words like If, Then, and Else are in bold with initial capital letters. This means that these words are specific required keywords in VB.NET. If you use them in a program statement, they have to be spelled exactly that way. The words condition and statements, on the other hand, are all lower case and in italics. This means that it's information you supply (even though there are still rules on what has to be there). Now notice that [ Then ] and [ statements ] are in brackets. Something inside brackets is optional.

Explore Visual Basic
By Category
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Using Decision Structures - Part 1

©2009 About.com, a part of The New York Times Company.

All rights reserved.