Facebook/LinkedIn login is now deprecated, please disconnect our access to your social profile.
Let us contribute to a cleaner Earth, Go Green Updated: May 31, 2020

break

  
  
module tb;
  	initial begin
      
      // This for loop increments i from 0 to 9 and exit
      for (int i = 0 ; i < 10; i++) begin
        $display ("Iteration [%0d]", i);
        
        // Let's create a condition such that the 
        // for loop exits when i becomes 7
        if (i == 7) 
          break;
      end
    end
endmodule

  
Simulation Log
ncsim> run
Iteration [0]
Iteration [1]
Iteration [2]
Iteration [3]
Iteration [4]
Iteration [5]
Iteration [6]
Iteration [7]
ncsim: *W,RNQUIE: Simulation is complete.

continue

  
  
module tb;
  	initial begin
      
      // This for loop increments i from 0 to 9 and exit
      for (int i = 0 ; i < 10; i++) begin 
        
        // Let's create a condition such that the 
        // for loop 
        if (i == 7) 
          continue;
        
        $display ("Iteration [%0d]", i);
      end
    end
endmodule	

  
Simulation Log
ncsim> run
Iteration [0]
Iteration [1]
Iteration [2]
Iteration [3]
Iteration [4]
Iteration [5]
Iteration [6]
Iteration [8]
Iteration [9]
ncsim: *W,RNQUIE: Simulation is complete.

You consent to our cookies if you continue to use our website. To know more about cookies, see our privacy policy. I accept cookies from this site.

Agree