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

Recommended Answers

All 4 Replies

>Any suggestions?

Exit Do

>Any suggestions?

Exit Do

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.