I mean for(i=1,0,i++)
Loop will execute or not?
12/3/2021 11:33:37 AM
What is an if-loop? Do you mean an if-statement? Or a for-loop? Or a while-loop?
Only the tag the programming language that is relevant to your question.
Without condition it would loop forever, so no it is not valid.
There is no such thing like "if loop", though by syntax I can tell it is a for loop. If it is a for loop, loop may not execute as data type of i is not specified
You mean Infinte loop??
zemiak even if you use if(true) it will be executed only once, it won't be in loop
I think 0 will not gonna happen this
Try True in place of 0
But itll happens in infinite loop
So you have to define condition somewhere to exit the loop
No it is not.
And with 0 condition will be false and you loop will not even run
First, all semicolons are mandatory. Second, technically the condition is not mandatory. Third, when using 0 the code will run but it will return nothing because it executes 0 times. Also, if you use an empty condition your loop will run forever.
What you can use of you want an infinite loop is 1==1 or something like that. Infinite loops are sometimes used for he's and the like, specifically for waiting for user input. Hope that helps.
Although as some else mentioned, it might be simpler to use a while loop.
If you don't provide a condition in your loop .... then it will turn out to be an infinite loop!!!
Send us a message