Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I have this do while look in JavaScript:

var dscr2 = 0.0;
var yield_on_debt = 0.0;
var interestCover = 0.0;
do {
    loanAmount = loanAmount - 5000;
    $scope.QuickQuoteData.LTV = loanAmount / propertyValue * 100.0;

    if ($scope.QuickQuoteData.LTV <= 70.0) {

        if ($scope.QuickQuoteData.LTV <= 55.0) {
            $scope.minmargin = 5.5;
            $scope.maxmargin = 6.0;
            $scope.amortisation = 0.0;
        }
        else if ($scope.QuickQuoteData.LTV > 55.0 && $scope.QuickQuoteData.LTV <= 60.0) {
            $scope.minmargin = 6.0;
            $scope.maxmargin = 6.5;
            $scope.amortisation = 1.0;
        }
        else if ($scope.QuickQuoteData.LTV > 60.0 && $scope.QuickQuoteData.LTV <= 65.0) {
            $scope.minmargin = 6.5;
            $scope.maxmargin = 7.0;
            $scope.amortisation = 2.0;
        }
        else if ($scope.QuickQuoteData.LTV > 65.0 && $scope.QuickQuoteData.LTV >= 70.0) {
            $scope.minmargin = 7.0;
            $scope.maxmargin = 7.5;
            $scope.amortisation = 3.0;
        }

        var annualInterest = loanAmount * (0 + $scope.maxmargin) / 100.0;
        var annualAmortisation = loanAmount / $scope.maxmargin / 100.0;
        interestCover = annualRent / annualInterest;
        dscr2 = (annualRent - annualInterest) / annualAmortisation;
        yield_on_debt = (annualRent / loanAmount) * 100;
    }
}
while ($scope.QuickQuoteData.LTV >= 70.0 && interestCover < 1.3 && dscr2 < 1.1 && yield_on_debt < 10.0);

The while condition doesn't really work with multiple conditions.

So for example once LTV will reach value of 70, althought the interestCover is > 1.3 the while loop is done.

Am I missing anything?

share|improve this question
    
Please spellcheck your question title and body. – torazaburo Aug 1 at 17:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.