brainfrz icon

Untitled

brainfrz | PRO | 09/12/15 11:20:17 PM UTC | 0 ⭐ | 784 👁️ | Never ⏰ | []
text |

620 B

|

None

|

0 👍

/

0 👎

I always thought the part between the curly braces were kind of like it's own little built in method
definition that just wasn't assigned a name, just like how a literal number or string can be defined
without a name. Therefore, I always looked at writing:
 if( i > 0 )
{
    print "Yippee!"
    print "I'm so happy";
}
else
{
    print "Aww...."
    print "Go away now";
}
  the same as:
  void passCheckPositive()
{
    print "Yipee!";
    print "I'm so happy";
}
 void failCheckPositive()
{
    print "Aww";
    print "Go away now";
}
 if (i > 0)
    passCheckPositive();
else
    failCheckPositive();

Comments