# Help with for(SOLVED)

**URL:** https://discourse.processing.org/t/help-with-for-solved/31184
**Category:** Coding Questions
**Tags:** homework
**Created:** [July 11, 2021, 8:59pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184 "2021-07-11T20:59:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ultimakey](https://avatars.discourse-cdn.com/v4/letter/u/b38774/32.png) [@ultimakey](https://discourse.processing.org/u/ultimakey)
#### Post date: [July 11, 2021, 8:59pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/1 "2021-07-11T20:59:37Z")

</div>

thank you TfGuy44 for helping me out!!  
(SOLVED)

---

<div class="post-metadata">

### Author: ![ultimakey](https://avatars.discourse-cdn.com/v4/letter/u/b38774/32.png) [@ultimakey](https://discourse.processing.org/u/ultimakey)
#### Post date: [July 11, 2021, 10:41pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/4 "2021-07-11T22:41:43Z")

</div>

Hey! Thanks for the help! I have a question though, what’s the TWO\_PI for? i’ve never seen that function before

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [July 11, 2021, 10:47pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/5 "2021-07-11T22:47:35Z")

</div>

`TWO_PI` is a constant, equal to `2` times `PI`. About 6.28…

In radians, `TWO_PI` is one full rotation of 360 degrees.

But I don’t want to rotate the squares all the way around - I only want to rotate them a little bit. 1/20 of a full rotation is right because there are 20 squares.

---

<div class="post-metadata">

### Author: ![ultimakey](https://avatars.discourse-cdn.com/v4/letter/u/b38774/32.png) [@ultimakey](https://discourse.processing.org/u/ultimakey)
#### Post date: [July 11, 2021, 10:49pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/6 "2021-07-11T22:49:31Z")

</div>

One last question, how’d you make the rectangles to alternate between black and white in order?

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [July 11, 2021, 10:52pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/7 "2021-07-11T22:52:04Z")

</div>

> [@TfGuy44](#):
>
> ` stroke(255 * (i%2));`

I’m setting the stroke color before I draw each rectangle. Since I am using the variable `i` in a loop, the first rectangle is “number 0”, the next one is “number 1” and so on.

`i%2` is 0 if `i` is even, and 1 if `i` is odd.

255 \* (i%2) is 255 times either 0 or 1. So odd numbered rectangles have a stroke of 255 (white) while even numbered rectangles have a stoke of 0 (black).

---

<div class="post-metadata">

### Author: ![ultimakey](https://avatars.discourse-cdn.com/v4/letter/u/b38774/32.png) [@ultimakey](https://discourse.processing.org/u/ultimakey)
#### Post date: [July 11, 2021, 10:54pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184/8 "2021-07-11T22:54:06Z")

</div>

Thank you so much! You’ve saved me a headache!
