note 22463 deleted from control-structures.break by nlopess
| From: | nlopess@php.net | Date: | Sat, 31 Jan 2004 10:16:39 +0000 |
| Subject: | note 22463 deleted from control-structures.break by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64473@lists.php.net to get a copy of this message | ||
Note Submitter: richard.hyan@ptmc.com
----
'break' can be combined with empty cycle too.
in that case it's very handy when performing code with transaction-like character or
substituting a very long if statement:
//doing some initialization (opening/creating devices..etc)
//assigning `false' or error-code to result
do{
if(*assertained the process won't be successful*)break;
//some code here (getting some semi-result)
if(*assertained the process won't be successful*)break;
//succes, returning result/result-code
}while(0);
//disposing all we have prepared