In reply to kolliparapavankumar:
These are both features introduced in Verilog-2001. generate/endgenerate are optional. The compiler can figure it out without them.
Lookup indexed part selects in the LRM. It has the same behavior as what you wrote.