I have an application with a config file from which various settings are read. One of them are the cycles that the appliaction is running. if this variable nLoops is -1 then it's supposed to run infinite times. Otherwise it shall run x times. At the moment this is how I implemented it. However I was wondering if there's a more straight forward way without the while(true) expression (I get a warning here)
//get nLoops from config file
int i = 0;
while (true)
{
if (nLoops > -1 && i >= nLoops)
break;
i++;
// do stuff
}
Aucun commentaire:
Enregistrer un commentaire