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
The body of variable or procedure name must use mixed case and complete as essential to define its purpose. Additionally, procedure names must begin with a verb, such as CloseDialo

Message Box: The Message Box can be specified a title as shown in figure to specify the title for the message box follow by the command given below:  Private Sub Command1_C

i need code for assignment problem of operational research in vb


i need to do my final project for my last year bsc honours degree in Business Information systems. I need to develop a system which is operational for hotel management system. th

Ask question #Minimum 10Public Class Form1 ''=============================================== ''Date: June 24, 2014 ''Author: Xochitl Nisbet ''Purpose: Convert Celsi

Deleting Records: To remove a record use the Delete method. To delete the record from the customer table follow the coding as shown below: data1.RecordSource = "Customer"

Files in a SDI and MDI Application: Both the SDI and MDI projects have 4 implementation files (.cpp extension). These are the files equivalent to the Document Class, View Clas

DATA TYPES   The different primitive data types are Boolean, Char, Byte, Date, Decimal, Uinteger, Double, Integer, Long, Sbyte, Short, Single, String, Ulong & Ushort. To decla

Sets or returns context ID for topic in Help File. If Help file is indicated in the VBScript Err Object HelpFile Property, the HelpContext property is utilized to display automatic