Control Structures in VB Dr. John Abraham Professor, UTPA
Sequential vs Selection Program Counter Transfer of control Goto unstructured Structured: sequence, selection and repetiton
Selection If..then If grade >= 60 then write(“Passed”) else write (“Failed”) End If
Nested selection If grade >= 90 then write(“A”) Else write(“B”) if grade >= 70 then write(“C”) write(“F”) End If
Alternative version If grade >=90 then write (“A”) ElseIf grade >=80 then write(“B”) ElseIf grade >= 70 then write(“C”) Else write(“D”) End If
Select Case Select Case Grade Case 100 statements Case 90 to 99 Case Else End Select
Repetition chapters 5 & 6 While – End While Do While – Loop Do Until – Loop For – Next Do – Loop While Do – Loop Until See example programs
While – End While Select a loop control variable (example grade) Initialize that variable (either read or assign) Set up loop like this While grade <= 100 Grade = console.readline() End while
Assignment3 Explained