đ Day 28 of My Automation Journey â Nested For Loop
Todayâs learning was super important đ đ Moving from single loops â nested loops đ This is where pattern logic begins đ„ đč 1. What is a Nested Loop? đ A loop inside another loop is called a ne...

Source: DEV Community
Todayâs learning was super important đ đ Moving from single loops â nested loops đ This is where pattern logic begins đ„ đč 1. What is a Nested Loop? đ A loop inside another loop is called a nested loop đĄ Structure: for(row) { for(column) { // logic } } đ§ How It Works đ Outer loop â controls rows đ Inner loop â controls columns đč 2. Basic Example (Print 1âs) for(int row = 1; row <= 2; row++) { for(int col = 1; col <= 5; col++) { System.out.print(1); } System.out.println(); } đ€ Output: 11111 11111 đč 3. Print Row Number for(int row = 1; row <= 2; row++) { for(int col = 1; col <= 5; col++) { System.out.print(row); } System.out.println(); } đ€ Output: 11111 22222 đč 4. Print Column Number for(int row = 1; row <= 2; row++) { for(int col = 1; col <= 5; col++) { System.out.print(col); } System.out.println(); } đ€ Output: 12345 12345 đč 5. Rectangle Pattern â for(int row = 1; row <= 3; row++) { for(int col = 1; col <= 5; col++) { System.out.print("*"); } Syst