After learning about the loops, now let's learn what are nested loops.
- Instead of writing a statement again and again, we write it once in a loop.
- We can also use a loop inside a loop and that is called nested loop.
- Nested loop means a loop statement inside another loop statement. Thus, it is also called a "loop inside loop".
- The inner loop executes completely whenever the outer loop executes.
Syntax:
for ( initialization; condition; increment ) {
for ( initialization; condition; increment ) {
// statement of inside loop
}
// statement of outer loop
}
- Same can be done with a while loop and do while loop.
- A square or many other patterns can be print with the help of nested loops.
Assignment:
Based on the logic that we have seen in this video. You have to build a cold to print some patterns.
1 A $$$$
12 AB $ $
123 ABC $ $
1234 $$$$
12345
123456
- You can use ASCII values to print the alphabet.
You can also check the video to upload the assignment on the GitHub.
In this video we will see:
- What are nested loops?
- Use of nested loops
- Syntax of nested loops
- Assignment based on nested loops
Instagram : [ Ссылка ]
Linkedin : [ Ссылка ]
Discord : [ Ссылка ]
More Learning :
Java - [ Ссылка ]
Python :- [ Ссылка ]
Django :- [ Ссылка ]
Spring Boot :- [ Ссылка ]
Spring Framework :- [ Ссылка ]
Servlet & JSP :- [ Ссылка ]
Hibernate Tutorial :- [ Ссылка ]
Rest API | Web Service Tutorial :- [ Ссылка ]
Git :- [ Ссылка ]
JavaScript :- [ Ссылка ]
Kotlin :- [ Ссылка ]
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
[ Ссылка ]
Ещё видео!