Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void DoStuff(Foo foo)
- {
- if (foo != null)
- {
- ...
- }
- }
- public void DoStuff(Foo foo)
- {
- if (foo == null) return;
- ...
- }
- function()
- {
- HRESULT error = S_OK;
- if(SUCCEEDED(Operation1()))
- {
- if(SUCCEEDED(Operation2()))
- {
- if(SUCCEEDED(Operation3()))
- {
- if(SUCCEEDED(Operation4()))
- {
- }
- else
- {
- error = OPERATION4FAILED;
- }
- }
- else
- {
- error = OPERATION3FAILED;
- }
- }
- else
- {
- error = OPERATION2FAILED;
- }
- }
- else
- {
- error = OPERATION1FAILED;
- }
- return error;
- }
- return a > 0 ?
- positively(a):
- negatively(a);
- if (a > 0)
- return positively(a);
- else
- return negatively(a);
- int f(int y) {
- int value = -1;
- void *data = NULL;
- if (y < 0)
- goto clean;
- if ((data = malloc(123)) == NULL)
- goto clean;
- /* More code */
- value = 1;
- clean:
- free(data);
- return value;
- }
- int g(int y) {
- value = 0;
- if ((value = g0(y, value)) == -1)
- return -1;
- if ((value = g1(y, value)) == -1)
- return -1;
- return g2(y, value);
- }
- function isCorrect($param1, $param2, $param3) {
- $toret = false;
- if ($param1 != $param2) {
- if ($param1 == ($param3 * 2)) {
- if ($param2 == ($param3 / 3)) {
- $toret = true;
- } else {
- $error = 'Error 3';
- }
- } else {
- $error = 'Error 2';
- }
- } else {
- $error = 'Error 1';
- }
- return $toret;
- }
- function isCorrect($param1, $param2, $param3) {
- if ($param1 == $param2) { $error = 'Error 1'; return false; }
- if ($param1 != ($param3 * 2)) { $error = 'Error 2'; return false; }
- if ($param2 != ($param3 / 3)) { $error = 'Error 3'; return false; }
- return true;
- }
- function isEqual($param1, $param2) {
- return $param1 == $param2;
- }
- function isDouble($param1, $param2) {
- return $param1 == ($param2 * 2);
- }
- function isThird($param1, $param2) {
- return $param1 == ($param2 / 3);
- }
- function isCorrect($param1, $param2, $param3) {
- $toret = false;
- if (!isEqual($param1, $param2)
- && isDouble($param1, $param3)
- && isThird($param2, $param3)
- ) {
- $toret = true;
- }
- return $toret;
- }
- resulttype res;
- if if if...
- return res;
- public void DoStuff(Foo foo)
- {
- if (foo == null) return;
- }
- void foo (int i, int j) {
- A a;
- if (i > 0) {
- B b;
- return ; // Call dtor for 'b' followed by 'a'
- }
- if (i == j) {
- C c;
- B b;
- return ; // Call dtor for 'b', 'c' and then 'a'
- }
- return 'a' // Call dtor for 'a'
- }
- A foo () {
- A a1;
- // do something
- return a1;
- }
- void bar () {
- A a2 ( foo() );
- }
- sub Int_to_String( Int i ){
- given( i ){
- when 0 { return "zero" }
- when 1 { return "one" }
- when 2 { return "two" }
- when 3 { return "three" }
- when 4 { return "four" }
- ...
- default { return undef }
- }
- }
- @Int_to_String = qw{
- zero
- one
- two
- three
- four
- ...
- }
- sub Int_to_String( Int i ){
- return undef if i < 0;
- return undef unless i < @Int_to_String.length;
- return @Int_to_String[i]
- }
- public void hello()
- {
- if ( ....)
- {
- ....
- }
- }
Add Comment
Please, Sign In to add comment