I am practicing while loop and below is code
PHONE_PRICE = 90;
bank_balance = 303.91;
amount = 0;
while (amount < bank_balance) {
amount = amount + PHONE_PRICE;
}
console.log("Your purchase: " + amount);
Now I understand after each iteration it is checking the condition and running the next iteration. I am trying to stop the next iteration if condition is going to be false. I have tried with do while loop as well however it gives the same behavior.
Here I am not trying to loop thru an array.... however trying to stop the iteration if condition is going to be false. Let me know if its same as loop thru an array in anyway