Beginning Programming All-in-One Desk Reference For Dummies
Book image
Explore Book Buy On Amazon

Most programming languages can make decisions based on the data you provide. Instead of performing the same tasks the same number of times, branching statements create a program that reads your data and automatically performs the tasks you need, skipping the tasks you don't need. Here are some branching commands that you'll need to know:

If (condition) Then command

If (condition) Then Commands End if
If (condition) Then Commands Else Commands End if
If (condition) Then Commands Elseif (condition2) then Commands End if
Select Case variable Case value1 Commands Case value2 Commands Else Commands End select
switch (variable) { case value1: Commands; break; case value2: Commands; break; default: commands; }

About This Article

This article is from the book:

About the book author:

Wallace Wang is a bestselling author with more than 2.3 million For Dummies books in print. He wrote Beginning Programming For Dummies and moonlights as a stand-up comic.

This article can be found in the category: