diff --git a/source/statements.tex b/source/statements.tex index 4f0c773c51..3c7488192c 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -595,13 +595,25 @@ \indextext{statement!\idxcode{do}} \pnum -The expression is contextually converted to \tcode{bool}\iref{conv}; -if that conversion is ill-formed, the program is ill-formed. +In the \keyword{do} statement the substatement is executed repeatedly +until the value of the \grammarterm{expression} becomes \tcode{false}. +The test takes place after each execution of the statement. \pnum -In the \keyword{do} statement the substatement is executed repeatedly -until the value of the expression becomes \tcode{false}. The test takes -place after each execution of the statement. +The \keyword{do} statement +\begin{ncsimplebnf} +\keyword{do} statement \keyword{while} \terminal{(} expression \terminal{)} \terminal{;} +\end{ncsimplebnf} +is equivalent to +\begin{ncsimplebnf} +\exposid{label} \terminal{:}\br +\terminal{\{}\br +\bnfindent \terminal{\{} statement \terminal{\}}\br +\bnfindent \keyword{if} \terminal{(} expression \terminal{)} \terminal{\{}\br +\bnfindent \bnfindent \keyword{goto} \exposid{label} \terminal{;}\br +\bnfindent \terminal{\}}\br +\terminal{\}} +\end{ncsimplebnf} \rSec2[stmt.for]{The \tcode{for} statement}% \indextext{statement!\idxcode{for}}