Skip to content

Commit 94896f8

Browse files
committed
small improvement to While Statement
1 parent 9f21647 commit 94896f8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

spec/statement.dd

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ $(GNAME WhileStatement):
301301
$(D while $(LPAREN)) $(EXPRESSION) $(D $(RPAREN)) $(PSSCOPE)
302302
)
303303

304-
$(P While statements implement simple loops.)
304+
$(P A $(I While Statement) implements a simple loop.)
305305

306306
$(P $(EXPRESSION) is evaluated and must have a type that can be converted to a
307307
boolean. If it's true the $(PSSCOPE) is executed. After the $(PSSCOPE) is
@@ -313,12 +313,19 @@ int i = 0;
313313
while (i < 10)
314314
{
315315
foo(i);
316-
i++;
316+
++i;
317317
}
318318
---
319319

320-
$(P A $(GLINK BreakStatement) will exit the loop. A $(GLINK ContinueStatement)
321-
will transfer directly to evaluating $(EXPRESSION) again.)
320+
$(P A $(GLINK BreakStatement) will exit the loop.)
321+
322+
$(P A $(GLINK ContinueStatement) will transfer directly to evaluating $(EXPRESSION) again.)
323+
324+
$(P A $(I While Statement) is equivalent to:)
325+
326+
---
327+
for (; Expression; ) ScopeStatement
328+
---
322329

323330
$(H2 $(LEGACY_LNAME2 DoStatement, do-statement, Do Statement))
324331

0 commit comments

Comments
 (0)