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
Properties: VBScript Err Object   Properties   Description   D escription Property The descriptive string related

I have an external application I open from visual studio (excel). I want to reposition where that opens (top, left).. How do I do that?

THREE MODELS FOR USER INTERFACE DESIGN   The 3 models for the user interface design are the implementation model, mental model &the manifest model. The Implementation Mod

Variable Scope Prefixes As script size rise, so does the value of being capable to rapidly differentiate the scope of variables. A one-letter scope prefix preceding type prefix

write a detailed account on ADO.net architecture.

i want to use two forms in vb.net. when the progress bar in form1 reaches on a specific value then disable form1 and progress bar will stop and the second Form2 will popup which wi

how do i create a change calculator that gives the denominations of coins for an amount of change up to .99 cents

I have an assignment In HCI , can anyone help me ?

DDX - Dialog Data Exchange: The Data members can be related with specific controls in the dialog box. When the dialog box is displayed, the DDX will transfer the values into t

DOCUMENT VIEW ARCHITECTURE The Document/View architecture is used to build an application based on the Microsoft Foundation Classes library. The Document/View architecture is s