错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Loops: How Do I Repeat Program Instructions Efficiently?

  • Joachim L. Zuckarelli

摘要

In programs we often need to repeat one or more similar instructions. To do this, we could simply write the instructions several times in a row. However, this is not only tedious and error-prone, but also always presents us with a problem if, at the time we write the program, it is not clear how many times the statements need to be executed in succession. This is where loops come into play. They allow controlled repetitions of the same (or almost the same) program code and make your programming work more efficient and your program look elegant.