1 / 9

Control Structures in VB

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.

jnguyen
Download Presentation

Control Structures in VB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Control Structures in VB Dr. John Abraham Professor, UTPA

  2. Sequential vs Selection • Program Counter • Transfer of control • Goto unstructured • Structured: sequence, selection and repetiton

  3. Selection • If..then • If grade >= 60 then write(“Passed”) else write (“Failed”) End If

  4. Nested selection If grade >= 90 then write(“A”) Else if grade >= 80 then write(“B”) Else if grade >= 70 then write(“C”) Else write(“F”) End If End If End If

  5. 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

  6. Select Case Select Case Grade Case 100 statements Case 90 to 99 statements Case 80 to 89 statements Case 70 to 79 statements Case Else statements End Select

  7. Repetition chapters 5 & 6 While – End While Do While – Loop Do Until – Loop For – Next Do – Loop While Do – Loop Until See example programs

  8. 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

  9. Assignment3 Explained

More Related