@@ -412,22 +412,24 @@ Otherwise, the \lit{else} body statement is executed.
Each of the program branches is executed in its own scope, which are denoted by the \lit{then} and \lit{else} tokens and the \lit{else} and \lit{fi} tokens, respectively.
\paragraph{While Loop Statements:}
A while loop statement \lit{while}is used to loop over a body statement, depending on the truth value of the condition given.
The statement is given a condition expression, that must be of type \lit{bool}, and a \lit{do}body statement to be executed if the condition is satisfied.
\hl{A while loop statement}\lit{\hl{while}}\hl{is used to loop over a body statement, depending on the truth value of the condition given.
The statement is given a condition expression, that must be of type}\lit{\hl{bool}}\hl{, and a}\lit{\hl{do}}\hl{body statement to be executed if the condition is satisfied.}
If the condition evaluates to \lit{true}, then the body statement is executed, until the \lit{done}keyword is reached. The \lit{while} loop then re-evaluates the condition again, using the
updated program state after executing the body statement, and the body statement is executed repeatedly as long as the condition evaluates to \lit{true}.
Otherwise, the program exits out of the loop, and continues to execute the next statement. If initially the condition evaluates to \lit{false}, the body statement
\hl{If the condition evaluates to }\lit{\hl{true}}\hl{, then the body statement is executed, until the}\lit{\hl{done}}\hl{keyword is reached. The}\lit{\hl{while}}\hl{loop then re-evaluates the condition again, using the
updated program state after executing the body statement, and the body statement is executed repeatedly as long as the condition evaluates to }\lit{\hl{true}}\hl{.
Otherwise, the program exits out of the loop, and continues to execute the next statement. If initially the condition evaluates to }\lit{\hl{false}}\hl{, the body statement
is never executed.
The condition statement may also never evaluate to \lit{true}. In this case, the loop is an infinite loop, and the program will never terminate.
The condition statement may also never evaluate to}\lit{\hl{true}}\hl{. In this case, the loop is an infinite loop, and the program will never terminate.}
\fillgap{\hl{Define/describe while loop statements}}{6 marks}
\paragraph{Scoping Statements:}
A scoping statement introduces a new program scope, which is denoted by the \lit{begin} and \lit{end} tokens.
\paragraph{Sequential Composition:}
\hl{... ??? ...}
\hl{This statement composes two statements into one line, to be executed in order. It is denoted by a}
\lit{\hl{;}}\hl{character between the two statements. For example, we can compose the statements s1 and s2 by writing}\lit{\hl{s1 ; s2}}\hl{.}
\hl{Both s1 and s2 must be valid statements for this composed statement to be valid, and s1 will be executed before s2.}