π 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