I recently learned that Qt provides a forever
keyword which allows you to enter in an infinite iteration loop. Is there any real life situation where one would want to do that? Isn't it always better practice to use foreach
?
Asked
Active
Viewed 94 times
1

NewEyes
- 407
- 4
- 15
-
It can be useful when you poll something on a second thread. – Abrikot May 28 '19 at 13:02
-
Can you elaborate? I do not understand what you mean. – NewEyes May 28 '19 at 13:09
-
1Semantically I think your asking the same as [What's the point of using “while (true) {…}”?](https://stackoverflow.com/questions/3947055/whats-the-point-of-using-while-true) – Alex K. May 28 '19 at 13:11
-
1@NewEyes > Sometimes, you want to check for a value being changed (such as temperature). You can then have an infinite loop that looks for a change and update a view. Alex K. comment should help you, too. – Abrikot May 28 '19 at 13:15