Skip to content

Commit 1a996a0

Browse files
committed
Update inline-comments.md
Added a visual example.
1 parent 756d822 commit 1a996a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

manual/en-US/coding-standards/chapters/inline-comments.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ Don’t use a blank line between comments and the code they refer to (no space u
1818

1919
Always have a single blank line before a comment or block of comments unless the comment (or block) is at the beginning of a code structure. ( You should not have a blank line after a '{' line )
2020

21+
For example in the following case there is no new line before the first comment (because it follows a '{' line) but we do want a new line before the second comment:
22+
23+
```php
24+
while (!$done)
25+
{
26+
// We don't want an infinite loop here.
27+
$done = true;
28+
}
29+
30+
//Now let's do something interesting.
31+
$result = somethingInteresting();
32+
```
33+
2134
Comments should align with the code they refer to, using the same indenting as the line that follows the comment.
2235

2336
Comments should be indented with tabs (like code, not like doc blocks).

0 commit comments

Comments
 (0)