java-development-for-beginners-learnit / 09 - Iteration Statements (Loops) in Java /005 Nested loops_en.srt
| 1 | |
| 00:00:05,000 --> 00:00:11,000 | |
| In this short lesson, we'll discuss when we need to use nested loops and how to do this, you can insert | |
| 2 | |
| 00:00:11,000 --> 00:00:18,000 | |
| loop inside another one, like in this example here I have my main loop and here is nested one. | |
| 3 | |
| 00:00:18,000 --> 00:00:19,000 | |
| When do you need this? | |
| 4 | |
| 00:00:20,000 --> 00:00:25,000 | |
| For example, when you iterate over multidimensional array from the index standpoint to have nested | |
| 5 | |
| 00:00:25,000 --> 00:00:31,000 | |
| loop, you just need to put one loop inside and another the one you should have called for this and | |
| 6 | |
| 00:00:31,000 --> 00:00:33,000 | |
| use Brace's in the output. | |
| 7 | |
| 00:00:33,000 --> 00:00:40,000 | |
| You see that the first iteration of Main Loop I started I equals to zero and after that three iterations | |
| 8 | |
| 00:00:40,000 --> 00:00:42,000 | |
| of nested loop are performed. | |
| 9 | |
| 00:00:42,000 --> 00:00:46,000 | |
| Here you can see zero one and two after that. | |
| 10 | |
| 00:00:46,000 --> 00:00:52,000 | |
| The second iteration of Main Loop is started and again three iterations of nested loop are performed | |
| 11 | |
| 00:00:52,000 --> 00:00:53,000 | |
| and so on. | |