Repeating a statement until a condition becomes true, Visual Basic Programming

You can employ until keyword in two ways to verify a condition in a Do...Loop statement. You can verify the condition before you enter the loop (as illustrated in the following ChkFirstUntil instance), or you can verified it after the loop has run at least once (as illustrated in the ChkLastUntil instance). As long as the condition is False, the loop will be continues.

Sub ChkFirstUntil()

Dim counter, myNum counter = 0

myNum = 20

Do Until myNum = 10 myNum = myNum - 1 counter = counter + 1

Loop

MsgBox "The loop made" & counter & "repetitions." End Sub

Sub ChkLastUntil()

Dim counter, myNum counter = 0

myNum = 1

Do

myNum = myNum + 1 counter = counter + 1

Loop Until myNum = 10

MsgBox "The loop made " & counter & " repetitions." End Sub

Posted Date: 4/18/2013 5:50:48 AM | Location : United States







Related Discussions:- Repeating a statement until a condition becomes true, Assignment Help, Ask Question on Repeating a statement until a condition becomes true, Get Answer, Expert's Help, Repeating a statement until a condition becomes true Discussions

Write discussion on Repeating a statement until a condition becomes true
Your posts are moderated
Related Questions
Fixed length strings: The Fixed length strings are declared by identifying the size of the string. For illustration to give a length of 20 for the string place, the declarati

In VBScript, You create user-defined constants using the Const statement. It lets you create string or numeric constants along with meaningful names and let you to assign them lite

The Refresh Method: The refresh method transfer to the first record in the record set. To invoke the refresh method follow the syntax which is as shown below: Form1.Data1.R

Associating Toolbars for the menu: 1. Insert the tool bar control to your form. 2. Now follow the steps to append the tool bar control to your form. 3. Then, Right Click

Numeric data types: The Integer, long integer are used for entire numbers. Single and doubles are related with the floating point numbers. Currency is related with numbers dea

Write Visual Basic programs for the following: 1.     Write a program that uses a "For Loop" to generate a list of temperature conversions in one degree increments from a given

need general help in pseudo code

Indexing: In libraries, the card catalog is the index. The three indices are used in the library. The Author, Subject and title are the 3 indices. Each index is relative. The

DIALOG   The dialog is a window which contains controls. The Dialog boxes are the form of input and output. The control can be placed on the dialog box for communicating. If y

Message Handling: 1. The message is send to the window. And it is sent to the Window Procedure. 2. The message map holds all the message handlers. 3. The window procedur