简体   繁体   中英

What type of construct is a for loop in JavaScript (or Python or R)

I understand how to write a for loop and what it does. If I wanted, however, to understand it more deeply, could I describe it as a block statement that with a expected group of keywords and appropriate syntax is used for (a type of) conditional execution?

I'd say yes. A for loop is a control-flow block structure, almost always with a calculable finite—often pre-defined—number of iterations, that performs the code inside the block. It often includes iterators so that the same algorithm within the block is applied to different elements as one traverses data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM