Computer Programming Branching Statements

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;
}







dummies

Source:http://www.dummies.com/how-to/content/computer-programming-branching-statements.html

No comments:

Post a Comment