Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java and Algorithmic Thinking for the Complete Beginner

You're reading from  Java and Algorithmic Thinking for the Complete Beginner

Product type Book
Published in Jun 2024
Publisher Packt
ISBN-13 9781836200130
Pages 957 pages
Edition 1st Edition
Languages
Author (1):
Aristides Bouras Aristides Bouras
Profile icon Aristides Bouras
Toc

Table of Contents (11) Chapters close

Preface 1. Part I Introductory Knowledge 2. Part II Getting Started with Java 3. Part III Sequence Control Structures 4. Part IV Decision Control Structures 5. Part V Loop Control Structures 6. Part VI Data Structures in Java 7. Part VII Subprograms 8. Part VIII Object-Oriented Programming 9. Part IX Files 10. Some Final Words from the Author

Chapter 25
Pre-Test, Mid-Test and Post-Test Loop Structures

25.1 The Pre-Test Loop Structure

The pre-test loop structure is shown in the following flowchart.

Image

Let's see what happens when the flow of execution reaches a pre-test loop structure. If Boolean_Expression evaluates to true, the statement or block of statements of the structure is executed and the flow of execution goes back to check Boolean_Expression once more. If Boolean_Expression evaluates to true again, the process repeats. The iterations stop when Boolean_Expression, at some point, evaluates to false and the flow of execution exits the loop.

The Decision symbol (the diamond, or rhombus) is used both in decision control structures and in loop control structures. However, in loop control structures, one of the diamond's exits always has an upward direction.

A “pre-test loop structure” is named this way because first the Boolean expression is evaluated, and afterwards the statement or block of statements...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime