note 23281 deleted from control-structures.for by spic
| From: | spic@php.net | Date: | Wed, 28 Aug 2002 08:38:11 +0000 |
| Subject: | note 23281 deleted from control-structures.for by spic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35875@lists.php.net to get a copy of this message | ||
Another tip about 'For Loops' inherent of C/C++
If the loop is only executing a single statement (which can happen from time to time) the opening
and closing brackets may be omitted.
Example:
for ($i=0; $i<10; $i++)
execute_this_statement;
Is the same as:
for ($i=0; $i<10; $i++) {
execute_this_statement;
}
Not an impressive feature, but it involves less typing and cleans up the code a bit.
This also works with 'If...Else' statements too.