Loop statement from inside the loop, Visual Basic Programming

Assignment Help:

You can exit a Do...Loop using the Exit Do statement. Since usually you desire to exit only in certain situations, such as to ignore an endless loop, you should employ the Exit Do statement in the True statement block of an If...Then...Else statement. If condition is False, the loop runs as usual. Or else, you probably did not require a loop in the first place.

In the following instance, myNum is assigned a value which creates an endless loop. The If...Then...Else statement verify for this condition, stop the endless repetition.

Sub ExitExample()

Dim counter, myNum counter = 0

myNum = 9

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

If myNum < 10 Then Exit Do

Loop

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


Related Discussions:- Loop statement from inside the loop

Create vb to play a variation of hangman, Goal Create a Visual Basic th...

Goal Create a Visual Basic that allows a user to play a variation of Hangman. User Inputs • The user types a letter into the textbox. Functional Items 1. Read a series

Data types - windows programming, Data types: The New data types were ...

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

Numeric data types - visual basic, Numeric data types: The Integer, lo...

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

Help cnt get result to disply, Ask question #Minimum 10Public Class Form1 ...

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

Option explicit declaration - data types, Option Explicit Declaration: ...

Option Explicit Declaration: If the option explicit is used essentially then all the variables will have to be declared. Or else an error will be reported saying that the vari

Homework Help, Creating an application that will calculate the cost of a ca...

Creating an application that will calculate the cost of a car rental based on the number of days that the car is rented. the cost of the car rental includes the cost of the car its

Tab order - dialog, Tab Order: The tab order stands for the order in w...

Tab Order: The tab order stands for the order in which the controls receive focus when the user clicks the tab key. The CTRL + D can be used to set the tab order of controls.

Intrinsic controls, INTRINSIC CONTROLS   The Intrinsic controls are th...

INTRINSIC CONTROLS   The Intrinsic controls are the built-in controls. Few of the controls are Combo box, Check box, Command Button, Label etc. The controls have properties re

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd