Skip to content
Advertisement

How to out of while and for loop combined

I am trying to write a code that is capturing number 3. using while loop as the condition, so that the for statement will be the evaluation condition of $x, of the while loop statement, and by the same time, using if statement to evaluate the value of $x=3 and so it can echo ‘three..’; . please enlighten me. thank you

JavaScript

Advertisement

Answer

In while loop, you should increment x variable. If you increment y variable, it will always “true”. So it will be endless loop.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement