Created
April 25, 2019 04:52
-
-
Save mikeschinkel/604ddc8d11d75028cac16e2ff6dcd416 to your computer and use it in GitHub Desktop.
do {...} while (false) example assuming WordPress/PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function some_function($value) { | |
do { | |
if ( some_condition ) { | |
break; | |
} | |
if ( some_other_condition ) { | |
break; | |
} | |
if ( some_further_condition ) { | |
break; | |
} | |
if ( isset($return) ) { | |
break; | |
} | |
... common code ... | |
} while (false); | |
return apply_filters('some_filter', $value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment