# Does a Timed Loop count as a form of iteration for the AP Create PT?

**URL:** <https://forum.code.org/t/does-a-timed-loop-count-as-a-form-of-iteration-for-the-ap-create-pt/37676>\
**Category:** CS Principles\
**Tags:** create-task\
**Created:** [February 27, 2023, 2:29pm UTC](https://forum.code.org/t/does-a-timed-loop-count-as-a-form-of-iteration-for-the-ap-create-pt/37676 "2023-02-27T14:29:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick.bahr](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/nick.bahr/32/1603_2.png) [@nick.bahr](https://forum.code.org/u/nick.bahr)\
**Post date:** [February 27, 2023, 2:29pm UTC](https://forum.code.org/t/does-a-timed-loop-count-as-a-form-of-iteration-for-the-ap-create-pt/37676/1 "2023-02-27T14:29:58Z")

</div>

Does a Timed Loop count as a form of iteration for the AP Create PT?  
’

> **[Code.org](https://studio.code.org/docs/ide/applab/expressions/timedLoop)**
>
> Anyone can learn computer science. Make games, apps and art with code.

I was thinking yes because it iterates until a condition is met, however, I’m not 100% certain.

TIA!

Nick

---

<div class="post-metadata">

**Author:** ![bhatnagars](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bhatnagars/32/4919_2.png) [@bhatnagars](https://forum.code.org/u/bhatnagars)\
**Post date:** [February 27, 2023, 4:28pm UTC](https://forum.code.org/t/does-a-timed-loop-count-as-a-form-of-iteration-for-the-ap-create-pt/37676/2 "2023-02-27T16:28:49Z")

</div>

To be on the safe side, I would use a loop like for loop or while loop. But, I would caution you that you are not allowed to tell the student whether you feel the timedLoop would count. You can certainly ask them if _they_ think it should count, but providing guidance of any kind is strictly not allowed.

---

<div class="post-metadata">

**Author:** ![varrience](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/varrience/32/8042_2.png) [@varrience](https://forum.code.org/u/varrience)\
**Post date:** [February 28, 2023, 3:16am UTC](https://forum.code.org/t/does-a-timed-loop-count-as-a-form-of-iteration-for-the-ap-create-pt/37676/3 "2023-02-28T03:16:04Z")

</div>

Greetings @nick.bahr,

as per your inquiry a timedLoop could count as an iterator, However trying to make a case that it does iterate will be much more challenging for a student to prove at least over using conventional means. In order to explain what i mean it may be able to show better with an example

```auto
var array = [1,2,3,4,7,8,21];
// lets start with a conventional statement
for(var i = 0; i < array.length; i++) {
 console.log(array[i]);
}
// now for the more unconventional iterator
var i = 0; // needs a seperate iterator outside
var iterator = setInterval(function(){ // needs an id to stop iterating
 console.log(array[i]);
 if(i < array.length-1) {
  i++;
 } else {
  clearInterval(iterator); // more work that is already implicity done by the for loop 
 }
},100)

```

as per my definition of an iterator it must have a start and stop point along with a progress tracker of where it is in the current loop, weather it be an index or an element, the second one uses a lot more steps to do what an implicit for loop is doing you can also use **while** or the **do while** loop though these may require more steps to get an iterator setup they’ll do the job better here. Recently, thanks to @jdonwells I’ve picked up another trait to my personal best practices. What is most important above all is intent using clear instructions takes much less time to understand and explain to get someone up to speed weather your on a team or asking for help.

Anyways hope this answers your question

Best, Varrience
