brainfrz

Untitled

Sep 12th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. I always thought the part between the curly braces were kind of like it's own little built in method
  2. definition that just wasn't assigned a name, just like how a literal number or string can be defined
  3. without a name. Therefore, I always looked at writing:
  4.  
  5. if( i > 0 )
  6. {
  7. print "Yippee!"
  8. print "I'm so happy";
  9. }
  10. else
  11. {
  12. print "Aww...."
  13. print "Go away now";
  14. }
  15.  
  16.  
  17. the same as:
  18.  
  19.  
  20. void passCheckPositive()
  21. {
  22. print "Yipee!";
  23. print "I'm so happy";
  24. }
  25.  
  26. void failCheckPositive()
  27. {
  28. print "Aww";
  29. print "Go away now";
  30. }
  31.  
  32. if (i > 0)
  33. passCheckPositive();
  34. else
  35. failCheckPositive();
Advertisement
Add Comment
Please, Sign In to add comment