Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition is True The condition can be placed at the Top or at the Bottom of the loop Align the Do and Loop - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition is True The condition can be placed at the Top or at the Bottom of the loop Align the Do and Loop

Description:

Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition is True – PowerPoint PPT presentation

Number of Views:291
Avg rating:3.0/5.0
Slides: 19
Provided by: JHa4
Category:

less

Transcript and Presenter's Notes

Title: Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition is True The condition can be placed at the Top or at the Bottom of the loop Align the Do and Loop


1
Do LoopsA Do..Loop terminates based on a
condition that is specifiedExecution of a
Do..Loop continues while a condition is True or
until a condition is TrueThe condition can be
placed at the Top or at the Bottom of the
loopAlign the Do and Loop statements with each
other and indent the lines of code to be repeated
in the body of the loop
2
Checking the condition before entering the
loopDo While / Until Condition statements
in the loopLoop
Testing for completion at the top of the
loop Also known as a pretest The statements
inside the loop may never be executed if the
terminating condition is True, the first time it
is tested
iTotal 0 Do Until iTotal 0 statements in
the loop Loop
3
Checking the condition after one iteration of the
loopDo statements in the loopLoop While /
Until Condition
Testing for completion at the bottom of the
loop Also known as a posttest The statements
inside the loop will always be executed at least
once
iTotal 0 Do statements in the
loop Loop Until iTotal 0
4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
ExampleCode a procedure that prompts the user
for a password to login. If the password is not
greater then 5 characters then a message is
displayed to the user. The user is allowed 3
attempts to login, if unsuccessful at this point
the application shuts down
13
ExampleCode a procedure that checks 5 times
whether the username is of a certain length (in
this case greater then 10 characters). After the
fifth attempt the user is locked out of the
application.
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com