Advertisement
Guest User

if statements and returns

a guest
Jul 26th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. public void doSomething() {
  2.  
  3.     if (!expensiveCall()) {
  4.         println("problem 1");
  5.         return;
  6.     }
  7.        
  8.     Object input = expensiveGet();
  9.     if (!expensiveCall2(input)) {
  10.         println("problem 2");
  11.         return;
  12.     }
  13.    
  14.         Object otherInput = expensiveGet2();
  15.         otherInput.setOption1();
  16.         otherInput.setExpensiveOption2();
  17.         if (!expensiveCall3(otherInput)) {
  18.             //problem
  19.             return;
  20.     }
  21.        
  22.         println("Everything OK!");
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement