Last active
April 15, 2017 17:26
-
-
Save craig-davis/fa59923e6a4d27d7fb534c943f3ed2b7 to your computer and use it in GitHub Desktop.
Code Without Else
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function calculateSalePrice($item, $discount = 0) { | |
if ($discount == 0) { | |
return $item->getPrice(); | |
} | |
return calculateDiscountedPrice($item->getPrice, $discount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment