Scroll to see replies
•
One or more instructions (the "body" of the loop) - i.e. the instructions which are executed at each pass or iteration
•
A conditional expression - i.e. a boolean expression which evaluates to true or false at each pass or iteration. The conditional expression decides whether the computer will 'break out' of the loop, or whether there will be another iteration.
WHILE ( Something is true )
Do instructions
END WHILE
•
The first thing a 'while' loop does is evaluate its expression for true or false.
•
In nearly all loops, the expression involves a variable whose value could change inside the loop body.
•
If the expression is true, it executes the body of the loop through a single pass.
•
When the loop has finished, the expression is evaluated again for true or false.
•
If the expression is still true, it executes the body of the loop through another single pass
•
When the loop has finished, the expression is evaluated again for true or false.
•
This keeps repeating until the expression finally evaluates to false - the program will 'break out' of the loop and carry on with the rest of the program.
LABEL "start"
IF ( Something is false )
GOTO LABEL "end"
ELSE
Do instructions
GOTO LABEL "start"
LABEL "end"
•
One or more instructions (the "body" of the loop) - i.e. the instructions which are executed at each pass or iteration
•
A conditional expression - i.e. a boolean expression which evaluates to true or false at each pass or iteration. The conditional expression decides whether the computer will 'break out' of the loop, or whether there will be another iteration.
WHILE ( Something is true )
Do instructions
END WHILE
•
The first thing a 'while' loop does is evaluate its expression for true or false.
•
In nearly all loops, the expression involves a variable whose value could change inside the loop body.
•
If the expression is true, it executes the body of the loop through a single pass.
•
When the loop has finished, the expression is evaluated again for true or false.
•
If the expression is still true, it executes the body of the loop through another single pass
•
When the loop has finished, the expression is evaluated again for true or false.
•
This keeps repeating until the expression finally evaluates to false - the program will 'break out' of the loop and carry on with the rest of the program.
LABEL "start"
IF ( Something is false )
GOTO LABEL "end"
ELSE
Do instructions
GOTO LABEL "start"
LABEL "end"
•
One or more instructions (the "body" of the loop) - i.e. the instructions which are executed at each pass or iteration
•
A conditional expression - i.e. a boolean expression which evaluates to true or false at each pass or iteration. The conditional expression decides whether the computer will 'break out' of the loop, or whether there will be another iteration.
WHILE ( Something is true )
Do instructions
END WHILE
•
The first thing a 'while' loop does is evaluate its expression for true or false.
•
In nearly all loops, the expression involves a variable whose value could change inside the loop body.
•
If the expression is true, it executes the body of the loop through a single pass.
•
When the loop has finished, the expression is evaluated again for true or false.
•
If the expression is still true, it executes the body of the loop through another single pass
•
When the loop has finished, the expression is evaluated again for true or false.
•
This keeps repeating until the expression finally evaluates to false - the program will 'break out' of the loop and carry on with the rest of the program.
LABEL "start"
IF ( Something is false )
GOTO LABEL "end"
ELSE
Do instructions
GOTO LABEL "start"
LABEL "end"
Last reply 2 days ago
went from 3s to 9s with (literally) night before revision - ask me anything59
Last reply 2 days ago
went from 3s to 9s with (literally) night before revision - ask me anything59