Download presentation
Presentation is loading. Please wait.
2
Programming Lecture #4 CS 101 Autumn 2006 Tariq Jadoon
3
In Lecture #3 Swapping Variables Conditional Code
4
Swapping the Contents of Two Variables X = 10 Y = 20 Temp = Y Y = X X Y 10 20 Temp 20 10
5
Swapping the Contents of Two Variables X = 10 Y = 20 Temp = Y Y = X X = Temp X Y 10 Temp 20
6
Debugging Using the Immediate Window as a scratchpad Placing Breakpoints Single stepping (F8) Placing Watches
7
Conditional Code VB has a number of block structures for conditional code: IF condition THEN action IF condition THEN action1 action2... END IF
8
Conditional Code (contd.) IF condition THEN action1 … ELSE action2 … END IF
9
Today Conditional Code (contd.) Loops
10
Conditional Code (contd.) IF condition1 THEN action1 … ElseIf condition2 THEN action2 … ElseIf condition3 THEN action3 … Else default action … END IF
11
Loops Repeat code –Counter Initial value Terminal Value Increment (step size)
12
Loops For c = 1 to 10 Step 2 action1 action2 … Next c Initial Value Terminal Value Increment Value Body of the loop Increment and check terminating condition
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.