I have this little piece of code for a world generation process and I want to have something very simple to make the creation easy to expand in size.

So I have this terrain which is generated several times in a row on the x axis, and what I want is, that when a certain amount of terrains have been placed it should move upwards. This is my current code:

```
if(terrain == 5) { alpha = alpha+ 1; origin = -distance; }

```

Which means if I wanted to have it jump every fith time I would need to have several of these if statements and cover all possible numbers:

```
if(terrain == 5) { alpha = alpha+ 1; origin = -distance; }
if(terrain == 10) { alpha = alpha+ 1; origin = -distance; }
if(terrain == 15) { alpha = alpha+ 1; origin = -distance; }
if(terrain == 20) { alpha = alpha+ 1; origin = -distance; }

```

and so on..

Now It would be much better if I could do that in one go and tell the program somehow that it should do it every x-th time without having to tell it seperately.

Here's the entire while loop that handles the generation:

```
    float alpha         = 0;
    float terrain       = 0;
    float origin        = 0;
    float distance      = 45;
    float num           = 20;

        while(terrain < num) {
            if(terrain == 0) {
                create_terrain(0,0,distance*alpha); terrain ++;
            }
                create_terrain(origin+distance,0,distance*alpha);
            terrain ++;
            origin += distance;

            if(terrain == 5) { alpha = alpha+ 1; origin = -distance; }
            if(terrain == 10) { alpha = alpha+ 1; origin = -distance; }
            if(terrain == 15) { alpha = alpha+ 1; origin = -distance; }
        } 

```

Thanks for any help!