Skip to content

Commit 157d923

Browse files
authored
Merge pull request #2977 from dlang/RazvanN7-patch-1
Spec change for Issue 16140 merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2 parents 5198541 + 7835ef4 commit 157d923

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

spec/statement.dd

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,11 @@ $(GNAME WhileStatement):
303303

304304
$(P A $(I While Statement) implements a simple loop.)
305305

306-
$(P $(EXPRESSION) is evaluated and must have a type that can be converted to a
307-
boolean. If it's true the $(PSSCOPE) is executed. After the $(PSSCOPE) is
308-
executed, the $(EXPRESSION) is evaluated again, and if true the $(PSSCOPE) is
309-
executed again. This continues until the $(EXPRESSION) evaluates to false.)
306+
$(P If the $(GLINK IfCondition) is an $(EXPRESSION), it is evaluated and must have a type
307+
that can be converted to a boolean. If it's true the $(PSSCOPE) is executed.
308+
After the $(PSSCOPE) is executed, the $(EXPRESSION) is evaluated again, and
309+
if true the $(PSSCOPE) is executed again. This continues until the $(EXPRESSION)
310+
evaluates to false.)
310311

311312
---
312313
int i = 0;
@@ -317,15 +318,22 @@ while (i < 10)
317318
}
318319
---
319320

320-
$(P A $(GLINK BreakStatement) will exit the loop.)
321+
$(P If an $(D auto) $(I Identifier) is provided, it is declared and
322+
initialized to the value and type of the $(EXPRESSION). Its scope
323+
extends from when it is initialized to the end of the $(PSSCOPE).)
321324

322-
$(P A $(GLINK ContinueStatement) will transfer directly to evaluating $(EXPRESSION) again.)
325+
$(P If a $(I TypeCtors) $(I Identifier) is provided, it is declared
326+
to be of the type specified by $(I TypeCtors) and is initialized with
327+
the value of the $(EXPRESSION). Its scope extends from when it is
328+
initialized to the end of the $(PSSCOPE).)
323329

324-
$(P A $(I While Statement) is equivalent to:)
330+
$(P If a $(I Declarator) is provided, it is declared and initialized
331+
to the value of the $(EXPRESSION). Its scope extends from when it is
332+
initialized to the end of the $(PSSCOPE).)
325333

326-
---
327-
for (; Expression; ) ScopeStatement
328-
---
334+
$(P A $(GLINK BreakStatement) will exit the loop.)
335+
336+
$(P A $(GLINK ContinueStatement) will transfer directly to evaluating $(GLINK IfCondition) again.)
329337

330338
$(H2 $(LEGACY_LNAME2 DoStatement, do-statement, Do Statement))
331339

0 commit comments

Comments
 (0)