# Would a nested conditional = a loop for the CPT?

**URL:** <https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461>\
**Category:** AP Prep\
**Created:** [March 26, 2021, 12:13pm UTC](https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461 "2021-03-26T12:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkelly](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rkelly](https://forum.code.org/u/rkelly)\
**Post date:** [March 26, 2021, 12:13pm UTC](https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461/1 "2021-03-26T12:13:58Z")

</div>

Hi! I have a few students who are using a nested conditional in their CPT and it works just like a loop. Would that count for the loop requirement on the scoring rubric? Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [March 26, 2021, 12:39pm UTC](https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461/2 "2021-03-26T12:39:57Z")

</div>

I wouldn’t think so. My guess is that it either doesn’t work just like a loop or it multiplies the complexity by several fold. Perhaps you are looking at recursion? You can show an example if you want a more detailed reply.

---

<div class="post-metadata">

**Author:** ![rkelly](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rkelly](https://forum.code.org/u/rkelly)\
**Post date:** [March 30, 2021, 2:40pm UTC](https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461/3 "2021-03-30T14:40:09Z")

</div>

Hi! Thanks for your feedback. Here is an example (it’s from CMU CS Academy - I am using the drop in units for my AP class):

app.background = ‘papayaWhip’  
app.stepsPerSecond = 20

starA = Star(95, 80, 90, 4, fill =‘lightSeaGreen’)  
starB = Star(297, 142, 70, 9, fill = ‘orchid’)  
rectA = Rect(27, 264, 165, 130, fill = ‘teal’)  
rectB = Rect(275, 229, 90, 140, fill = ‘lavender’)

def onStep():  
starA.rotateAngle -= 9  
starB.rotateAngle += 3  
rectA.rotateAngle -= 2  
rectB.rotateAngle += 5

def onKeyPress(key):  
if (key == ‘f’):  
app.stepsPerSecond \*=2  
elif (key == ‘s’):  
app.stepsPerSecond /=2  
elif (key == ‘n’):  
app.stepsPerSecond = 20

It continuously spins and seems to work like a loop. Thanks again for any feedback!

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [March 30, 2021, 3:16pm UTC](https://forum.code.org/t/would-a-nested-conditional-a-loop-for-the-cpt/34461/4 "2021-03-30T15:16:35Z")

</div>

That doesn’t count. The spinning stars use a built in loop. The Create Task rules are explicit about built in stuff not counting against the rubric.
