code_junkie

Quick question about returning from a nested statement

Nov 12th, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. bool b;
  2.  
  3. public bool ifelse(int i)
  4. {
  5. if(i == 5)
  6. {
  7. b = true;
  8. }
  9.  
  10. else
  11. {
  12. b = false;
  13. }
  14. return b;
  15. }
  16.  
  17. public bool ifelse(int i)
  18. {
  19. if(i == 5)
  20. {
  21. return true;
  22. }
  23. else
  24. {
  25. return false;
  26. }
  27. }
  28.  
  29. return i == 5;
  30.  
  31. public bool ifelse(int i)
  32. {
  33. if(i == 5)
  34. {
  35. return true
  36. }
  37. return false
  38. }
  39.  
  40. public bool ifelse(int i)
  41. {
  42. bool b;
  43. /*
  44. Some code to calculate b
  45. */
  46. return b;
  47. }
Add Comment
Please, Sign In to add comment