Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition
by Paul J. Deitel - Deitel & Associates, Inc., Harvey M. Deitel - Deitel & Associates, Inc.
5.5. While Repetition Statement
A repetition statement (also called a looping statement or a loop) allows you to specify that an action should be repeated, depending on the value of a condition (called the loop-continuation condition).
As an example of a While statement (sometimes more formally referred to as the While...End While statement), consider a program designed to find the first power of 3 larger than 100 (Fig. 5.4). In line 5, we take advantage of a Visual Basic feature that allows variable initialization to be incorporated into a declaration. When the While statement is entered (line 9), product is 3. Variable product is repeatedly multiplied by 3 (line 11), taking on the values 3, 9, 27, 81 and 243, successively. When product becomes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access