# If Then Else alternative

**URL:** <https://forum.kirupa.com/t/if-then-else-alternative/206420>\
**Category:** flash\
**Created:** [November 8, 2006, 1:21am UTC](https://forum.kirupa.com/t/if-then-else-alternative/206420 "2006-11-08T01:21:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scriptrookie](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scriptrookie](https://forum.kirupa.com/u/scriptrookie)\
**Post date:** [November 8, 2006, 1:21am UTC](https://forum.kirupa.com/t/if-then-else-alternative/206420/1 "2006-11-08T01:21:10Z")

</div>

Hi guys,

I made a script which will tile dynamic mc in a way that after a number of clips (say 5) in a row, i would like the 6th mc to position on the next row below the first row, like this:

1 2 3 4 5  
6 7 8 9 10

i was able to do it thru series of if-else if statements but the thing is that i was wondering if there’s a better logic in doing this, i was thinking of using switch statement but is there a way to type “i\>=9 && i\<=20” into a case parameter? here is the code and i have also attached the fla if anyone would like to see:

```auto

 if (i>=20 && i<=25) {
  item._x = item._width+275;
  yVal = (i-20)*(item._height+5);
  item._y = yVal;
  trace(yVal);
 }
 else if (i>=15 && i<=19) {
  item._x = item._width+185;
  yVal = (i-15)*(item._height+5);
  item._y = yVal;
  trace(yVal);
 } else if (i>=10 && i<=14) {
  item._x = item._width+95;
  yVal = (i-10)*(item._height+5);
  item._y = yVal;
  trace(yVal);
 } else if (i>=5 && i<=9) {
  item._x = item._width+5;
  yVal = (i-5)*(item._height+5);
  item._y = yVal;
  trace(yVal);
 } else {
  yVal = i*(item._height+5);
  item._y = yVal;
  trace(yVal);
 }

```

Thanks for help!

\_ScriptRookie
