Template directive: loop 2.6+

The @loop(): directive is a custom conditional loop operator. It is being used to loop from a lower value to an higher value.
for
Example: loop
   @loop($i: 5 -> 10): 
   
    List {{ $i }} <br>
     
   @endloop;
                
The sample code above is similar to the @for(): directive. Internally, it translates to
   @for($i=5; $i <= 10; $i++):
   
    List {{ $i }} <br> 
    
   @endfor;
                
The 5 -> 10 means that the loop should run starting from the number 5 and ending at number 10. The resulting response is shown below.
    
   List 5 
    
   List 6 
    
   List 7 
    
   List 8 
    
   List 9 
    
   List 10 
      
                
Similarly we can parse arguments from routes and loop through the parsed variable. An example of this is shown below:
  <?php 
  
  namespace spoova\mi\windows\Routes;
  
  use Route;
  
  class Home extends Route {
  
     function __construct() {
        
        // define only variable $list
        $args = [ 'list' => [1, 2, 3, 4, 5] ];        
    
        self::call($this, [
        
           // set method for accepted url: home
           LASTURL() => 'home';
           
           // parse variables to method
           SELF::ARGS => $args

        ]);
     
     } 
     
     function home($args) {
       
       //compile template 'home' with variables
       self::load('home' => compile($args));
       
     }
  
  } 
                
Now we can loop through the $list variable
   @loop($i: 0 -> (count($list) - 1)):
   
    List {{ $list[$i] }} <br>
     
   @endloop;
                
The resulting response is shown below
    
   List 1 
    
   List 2 
    
   List 3 
      
                
The loop directive also supports normal operators like ==, >, <. An example is shown below:
   @loop($i: 5 < 10): 
   
    List {{ $i }} <br>
     
   @endloop;
                
The code above simply translates that the loop should run from number 5 to number 9 since 5 is less than 10. The result of this loop is shown below
    
   List 5 
    
   List 6 
    
   List 7 
    
   List 8 
    
   List 9 
      
                
With the loop directive we can also easily shift from an higher number to a lower number. For example, the code below will move down from 10 to 5.
   @loop($i: 5 <- 10): 
   
   List {{ $i }} 
   
   @endloop;
                
The back <- custom operator can also be replaced with the <@ while the front <- operator can be replaced with the @> operator. An example is shown below:
   @loop($i: 5 <@ 10): 
   
   List {{ $i }} 
   
   @endloop;
                
The result of this loop is shown below :
    
   List 10 
    
   List 9 
    
   List 8 
    
   List 7 
    
   List 6 
    
   List 5