Home Technical Talk

mel- how to repeat a command x times?

greentooth
Offline / Send Message
WaYWO greentooth
So how to repeat a command x known number of times in Mel? It is important for me.

Replies

  • Bartalon
    Options
    Offline / Send Message
    Bartalon polycounter lvl 12
    You want to look into for loops. Here is a basic loop:
    for ($i=0; $i<5; ++$i) {
         print ( "Loop " + $i );
    }
    
    $i=0 : Starting value of the loop. 0 is most common
    $i<5 : Loop will continue to perform its actions as long as $i is less than 5. If $i is not less than 5, then the for loop stops.
    ++$i : After each loop, $i gains 1 to its value.
  • WaYWO
    Options
    Offline / Send Message
    WaYWO greentooth
    Bartalon wrote: »
    You want to look into for loops. Here is a basic loop:
    for ($i=0; $i<5; ++$i) {
         print ( "Loop " + $i );
    }
    
    $i=0 : Starting value of the loop. 0 is most common
    $i<5 : Loop will continue to perform its actions as long as $i is less than 5. If $i is not less than 5, then the for loop stops.
    ++$i : After each loop, $i gains 1 to its value.


    going to test it out now, see if it works, thanks :)
  • WaYWO
    Options
    Offline / Send Message
    WaYWO greentooth
    works like a charm ;
Sign In or Register to comment.