DB section has been updated to add some SQL code.
A fixed loop is when a sequence of code has to be repeated more than once. This number of times has to be known beforehand.
The loop above would be ran 5 times. The variable num is used to control how many times the loop runs, it will start as 0 and each time the loop is executed it will be incremented (increased by 1) and it will stop before it reaches 5, so will be 0,1,2,3 and 4.
A control variable can also be used to allow the user to enter the number of times that the loop is to be run before it is executed. This is still a fixed loop as the amount of times the loop is to be executed is decided before the loop starts.
This can be shown in the flow chart below.
Flow chart showing how to control the amount of times a fixed loop executes.
The above code will ask the user how many times to repeat the loop.Â