for structure

for structure usually use when you know how many times you will loop

Simple for structures:

for <time counts> times

<tasks to do repeatedly>

<tasks to do repeatedly> could be single command or block

$_time is a var that hold the loop time, starting with 1.

Ex: Write 3 time “I’ll never play games in classes.”, with number:

for 3 times

    @echo $_time . “. Hello world.”

> 1. Hello world.

> 2. Hello world.

> 3. Hello world.

You could also use at keyword here

Ex: Write 4 time “I’ll never play games in classes.”, at time 3, write “This is time 3” :

for 3 times

     @echo $_time+”. Hello world.”

     at $_time = 3

         ” This is time 3″

> 1. Hello world.

> 2. Hello world.

> 3. Hello world. This is time 3

You could replace times with any variable:

for 3 $i

     for 3 $j

         if $j = $i:

             @echo ‘ * ‘

         else:

             @echo ‘ ‘

> *

>  *

>   *

Full for structures:

for <initation>,<break_condition>,<increasement>

<tasks to do repeatedly>

Ex: Write 3 time “I’ll never play games in classes, with number”:

for $i:1,$i<3,$i++

     @echo ($i+1)”. Hello world.”

> 1. Hello world.

> 2. Hello world.

> 3. Hello world.