# How should I modify this for loop to satisfy a condition?

**URL:** <https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994>\
**Category:** Beginners\
**Created:** [February 22, 2020, 3:34am UTC](https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994 "2020-02-22T03:34:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon94203042](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Post date:** [February 22, 2020, 3:34am UTC](https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994/1 "2020-02-22T03:34:40Z")

</div>

So let’s say that we have a for loop:

```auto
SIZE = 3; // can be changed later on

for (int a = 250; a < SIZE; a += 100)

```

What number should I add/multiply to `SIZE` so that the loop only runs 3 times? And I can’t set `SIZE` to a fixed number because it can change later on.

Thanks

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [February 22, 2020, 3:57am UTC](https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994/2 "2020-02-22T03:57:36Z")

</div>

Start here to understand for loops:  
[https://processing.org/reference/for.html](https://processing.org/reference/for.html)

Write a few lines of code and try it.
