Programming Languages
C++
Subjective
Mar 13, 2013
Create a function that is only available inside the scope where it is defined ?
Detailed Explanation
$pvt = Calculation(5,5);
print("Result = $pvt\n");
sub Calculation{
my ($fstVar, $secndVar) = @_;
my $square = sub{
return($_[0] ** 2);
};
return(&$square($fstVar) + &$square($scndVar));
};
Output: Result = 50
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts