Fork in a for loop

In reply to Husni Mahdi:


module tb;	  
    initial begin    
      **for (int i = 2; i>=0; i--)** begin
          **automatic int j = i;**
            fork
                begin
                   //automatic int j = i;
                    print(j);
                end
            join_none
        end        
        #50 $finish;
    end    
 
    task automatic print (input int i);
        #10
        $display($time, "ns || %d", i);
    endtask    
endmodule

output :-

10ns || 0

10ns || 1

10ns || 2