Hello. I wonder which is better safely on commercial projects “yield return condition;” with
“while(condition) { yield return null;}”. Thanks.
//This loop will go infinitely.
while(true){
//Stuff here
}
//This loop can only go 10 times
int x = 0;
while(x < 10){
x += 1;
}
while loops are safe as long as there is a very rare or never chance they will run infinitely
while loops are perfectly safe withing co-routines as long as you yield. Even while(true) loops.
Thank you for all replies.