Download presentation
Presentation is loading. Please wait.
Published byHilary Dean Modified over 9 years ago
1
Statements That Repeat
2
For...Next Loop Structure For counter = start To end Step increment statements Next counter Where Counter is tested to see if less than end. If so, repeat loop again. If not, go to statement after Next.
3
Do While...Loop Structure Do While condition statements Loop Where The condition is tested, and if true the loop is repeated. When the condition is false, the loop statements are skipped the statement after Loop is executed.
4
Do Until...Loop Structure Do Until condition statements Loop Where The condition is tested, and if false the loop is repeated. When the condition is true, the loop statements are skipped the statement after Loop is executed.
5
‘Calculate the factorial of a number given by user Dim Factorial As Double Dim I As Integer I = 1 Factorial = 1 Do While I <= Val (txtAnswer.text) Factorial = Factorial + 1 I = I + 1 Loop Do Until...Loop Structure User gives number
6
Loops with the Marching Band Project Hands-On Exercise 3 (P.134-145) –Create the Marching Band Project –Add Command Buttons and a Timer –Add Controls to Display the Band –Add Banner Comments –Add Code for Buttons and the Form –Add Code to Add Animation –Run, Save, Test and Debug Your Project –Create a Copy of the Project –Change Animation Code –Update, Run, Save, Test and Debug –Exit Visual Basic
7
Summary... Fundamental programming demonstrated Variables vs. Constants Data types Local vs Global variables Functions and Procedures Control structures: sequence, selection and repetition
8
Summary Statements –Dim, Static, Const –Public, Private –Sub, Function –Do...Loop, Do While...Loop, Do Until...Loop –For Each...Next, For...Next –If...Then...Else –Select Case
9
Practice with Visual Basic 1. Learning to Subtract Game (P.148) 2. Wind Chill in Celsius (P.148) 3. Heat Index (P.148) 4. Rock, Paper, Scissors Game(P.150)
10
Case Studies Calculate a Formula Weather Calculations More Fun and Games More Web Resources for Visual Basic
11
End of Lecture
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.