- 4

can we do infinite loop with loop

yes by calling main in main

4th May 2017, 12:31 PM
Vivek kumar
5 Réponses
+ 13
But it isn't loop. It is called RECURSION. For infinite loops just write: while(true) That's it! Everything you need for infinite loop. Also recursion will cause 'StackOverflow' exception or something else in different languages.
4th May 2017, 12:42 PM
WittyBit
WittyBit - avatar
+ 13
@Nicola Your have so much logical issues, but it will work. Just while(1) will be fine. So x = 1 will set x to 1, not compare. Just write == or while(true)
4th May 2017, 12:52 PM
WittyBit
WittyBit - avatar
4th May 2017, 1:07 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Yes we can :)
4th May 2017, 12:42 PM
Nikola Stojiljkovic
Nikola Stojiljkovic - avatar
+ 1
x=1; while(x=1){ console.log(x); } js example :)
4th May 2017, 12:45 PM
Nikola Stojiljkovic
Nikola Stojiljkovic - avatar