Since the invention by Von Neumann of the stored program computer, computer scientists have known that a tremendous power of computing equipment was the ability to alter its behavior, depending on the input data. Calculating machines had, for some time, been able to perform fixed arithmetic operations on data, but the potential of machines capable of making decisions opened up many new possibilities. Machines that could make decisions were capable of sorting records, tabulating and summarizing data, searching for information, and many more advanced operations that could not even be imagined at the time.
In early programming languages, like Fortran (first invented in 1954) and various low level machine languages, the goto statement allowed the computer to deviate from the sequential execution of the program instructions. The goto statement was recognized to be a very powerful construction, and soon, programs of increasing complexity and power were developed.
However, the increasingly complex code that resulted from goto statements became harder and harder to maintain. Dijkstra, in 1966, was one of the first persons to recognize that this run away complexity of programs was due to the overuse of the goto statement (Dijkstra, E. W., "Go To Considered Harmful," Communications of the ACM, March 1966). In fact, it was determined shortly thereafter, that the goto statement is not needed at all. Dijkstra showed that any program construction that could be created with goto statements could be created more simply with the sequence, repetition and decision constructions that are discussed in the following sections. This was the birth of the discipline of Structured Programming.
 
Add flour.
2. Repetition   Repeat a block of statements while a condition
is true.
Stack dishes by sink.
3. Selection   Choose at most one action from
several alternative conditions.
Get mail from mailbox.
 
Example:
x = 5
 
For i = 1 To n Step k   ' Step k is optional
For i = 1 To 20
For i = 20 To 1 Step -1
If condition1 Then
If n = 1 Then
Select Case value1
Select Case n
Structured Programming in Everyday Life
1. Sequence   Execute a list of statements in order.
Example: Baking Bread
 
Add salt.
Add yeast.
Mix.
Add water.
Knead.
Let rise.
Bake.
Example: Washing Dishes
 
Fill sink with hot soapy water.
While moreDishes
    Get dish from counter,
    Wash dish,
    Put dish in drain rack.
End While
Wipe off counter.
Rinse out sink.
Example: Sorting Mail
 
Put mail on table.
While moreMailToSort
    Get piece of mail from table.
    If pieceIsPersonal Then
       Read it.
    ElseIf pieceIsMagazine Then
       Put in magazine rack.
    ElseIf pieceIsBill Then
       Pay it,
    ElseIf pieceIsJunkMail Then
       Throw in wastebasket.
    End If
End While
Structured Programming in Visual Basic
Structured programming is a program written with only
the structured programming constructions: (1) sequence, (2) repetition, and (3) selection.
 
y = 11
z = x + y
WriteLine(z)Extensions to Structured Programming
To make programs easier to read, some additional constructs were added to
the basic three original structured programming constructs:
     action
Next
    WriteLine(i)
Next i
    WriteLine(i)
Next
    action1
ElseIf condition2 Then
    action2
ElseIf condition3 Then
    action3
Else
    defaultAction
End If
    WriteLine("One")
ElseIf n = 2 Then
    WriteLine("Two")
ElseIf n = 3 Then
    WriteLine("Three")
Else
    WriteLine("Many")
End If
    Case value1
       action1
    Case value2
       action2
    Case value3
       action3
    Case Else
       defaultAction
End Select
    Case 1
       WriteLine("One")
    Case 2
       WriteLine("Two")
    Case 3
       WriteLine("Three")
    Case Else
       WriteLine("Many")
End Select