Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Created April 25, 2019 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeschinkel/604ddc8d11d75028cac16e2ff6dcd416 to your computer and use it in GitHub Desktop.
Save mikeschinkel/604ddc8d11d75028cac16e2ff6dcd416 to your computer and use it in GitHub Desktop.
do {...} while (false) example assuming WordPress/PHP
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