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
INTRODUCTION to VISUAL C++ PROGRAMMING This section introduces you to develop the applications using VC++. The Single document interface (SDI), multiple document interface (MDI

Variant Type: If no data type is related with the VB variables, it takes the default variant type. The variable x will be of the variant type when the two declarations below a

A For Each...Next loop is similar to a For...Next loop. Rather than repeating the statements a particular number of times, For Each...Next loop repeats group of statements for each

Question 1 Write about the Visual Basic Application Development Life cycle with a sample Forms development for performing integer arithmetic operations Question 2 Discuss the

Creation of the Menu in VB 1. Initiate a new project by choosing a file and then new project. 2. Now select the Standard EXE as the Project type. 3. Build the Form1 activ

HOW TO SOLVE ORDINARY DIFFERENTIAL EQUETION IN VISUAL BASIC PROGRAMMING

Assume you are creating an order entry and editing application for a book store. An order consists of a product, quantity, total price, payment type including Credit/Debit card acc

HOW TO MAKE ER DIAGRAM FOR DISTRIBUTER MANAGEMNET OF WATER PURIFIAR

departmental store attributes

GDI OBJECTS   The CDC provides 5 versions for the GDI objects. They are fonts, brushes, pens, bitmaps and regions. The Select Object function substitutes the current GDI objec