# How to turn this code into a simple loop?

**URL:** <https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098>\
**Category:** Coding Questions\
**Created:** [November 1, 2018, 9:57pm UTC](https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098 "2018-11-01T21:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rollbon](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@rollbon](https://discourse.processing.org/u/rollbon)\
**Post date:** [November 1, 2018, 9:57pm UTC](https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098/1 "2018-11-01T21:57:53Z")

</div>

How can I turn this code into a simple loop using **‘for’** command?  
The first circle is the smallest circle, each circle, fill subtracts 30 and size grows by 10. The x and y stay the same.

```auto
void setup(){
  size(500, 500);
}

void draw(){
  background (0);
  noStroke();
  fill(100);
  ellipse(250,250,60,60);
  fill(130);
  ellipse(250,250,50,50);
  fill(160);
  ellipse(250,250,40,40);
  fill(190);
  ellipse(250,250,30,30);
  fill(220);
  ellipse(250,250,20,20);
  fill(250);
  ellipse(250,250,10,10);
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 1, 2018, 10:27pm UTC](https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098/2 "2018-11-01T22:27:08Z")

</div>

try

```auto
for (int i=5;i>=0;i--) { fill( 250 - i*30); ellipse(250,250,10+10*i,10+10*i); }

```
