Questions about this topic? Sign up to ask in the talk tab.
Perl/Basics/Boolean Logic/Statements/Golfing
From NetSec
Revision as of 01:19, 19 July 2012 by Chantal21I (Talk | contribs) (moved Perl/Basics/Statements/Golfing to Perl/Basics/Boolean Logic/Statements/Golfing)
The term golfing applies to condensing a boolean statement into one line. Golfing is typically used when you only need to execute one line of code for a boolean statement.
print "You are not 18 or older!\n" unless ($age >= 18); |
- Is essentially the same as:
print "You are not 18 or older!\n" if ($age < 18); |
- Is essentially the same as this un-golfed statement:
unless ($age >= 18) { print "You are not 18 or older!\n"; } |