0

Hi, I would like to terminate a do until ....loop when future value is greater than 1000 without using a Exit or Continue statement. Any suggestions? Thanks

Do Until inti > intMonths

            decFutureValue = (decFutureValue +  decMonthlyInvestment)  * (1 + decMonthlyInterestRate)

If decFutureValue > 1000 Then

End if
             
            inti += 1
        Loop
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by mikeandike
0

>Any suggestions?

Exit Do

I am actually trying to do it without using an Exit Do or a continue statement. Any ideas? - Thanks

1

Add an "Or" clause to your loop exit criteria. Example:

Sub Main()

        Dim i As Integer = 0
        Dim j As Integer = 0

        Do Until i > 100 Or j > 120
            i += 3
            j += 5
        Loop

        Console.WriteLine("i: {0}", i)
        Console.WriteLine("j: {0}", j)
        Console.Read()

    End Sub
0

Thank You very much! I really appreciate the support from this community!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.