什么时候使用 do-while 合适? [英] When is a do-while appropriate?
本文介绍了什么时候使用 do-while 合适?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么时候 do-while 比其他类型的循环更好?有哪些常见场景比其他场景更好?
When is a do-while the better choice over other types of loops? What are some common scenarios where its better than others?
我了解 do-while 的功能,但不知道何时使用它.
I understand the function of a do-while, but not when to use it.
推荐答案
当你需要做某事至少一次,但不知道启动循环前的次数时.
When you need something done at least once, but don't know the number of times prior to initiating the loop.
这篇关于什么时候使用 do-while 合适?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文