As this code has multiple loops, so how do the loops work. As in, for example, how does the machine know that it has to print all spaces before moving to next loop(value loop).
By this format, shouldn’t it execute the space loop once then the value loop then once the cycle is complete then back to the space loop. Please explain.
Order of loop execution
Loop has only one thing to do that is to maintain count between starting and ending point which is being provided by the programmer. Compiler whenever sees a loop it only executes on the count on which it’s being iterated. It’s the programmer who designs complexity with the loops to generate pattern and perform multiple operations.
So basically when a loop is given to the compiler, it first gets done with that specific loop until the end of the loop(stopping condition) is reached and then moves on to the next task
Yes , whenever compiler sees a loop it executes the operation in that loop number of times until it’s stoping condition is achieved.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.