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
I would like someone to look at my code and tell me why it''s not working

Properties: VBScript Err Object   Properties   Description   D escription Property The descriptive string related

What are the differences between Property Get, Set and Let? Set - Value assigned to ActiveX Object from the form. Let - Value retried to ActiveX Object from the form. Get- Assigns

FEATURES OF USER INTERFACE DESIGN The features like how will the software's are used? Who will be the users? What will be the life of the software? During its lifetime how ofte

Assigning Values to Variables Values are assigned to variables creating an expression as follows: the variable is on the left side of the expression & the value you desire to a

#questiontypes of lines and how to draw

For this assignment you have to design and implement a VB.NET project which prepares a bill of payment due, given the purchase amount. The project models a typical purchase transac

Data types: The New data types were defined by using the typedef or #define statements. This was to allow the transition from 16 bit to 32 bit system. Some of the fresh data t

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

INTRODUCTION TO CONTROLS AND TOOLBARS The Visual Basic programming is an event driven programming. In the form objects the termed controls are placed. We can put the properties