Last active
December 25, 2015 00:29
-
-
Save michal-lipski/6887828 to your computer and use it in GitHub Desktop.
Strange behavior when extracting method
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
//code before extracting method from part marked with <selection>: | |
float discount; | |
//some code | |
<selection> | |
discount = 0 ; | |
if (unitPricePerQuantity() >= 100) { | |
discount = unitPricePerQuantity() * 10 / 100; | |
} | |
</selection> | |
//method extracted from selected code: | |
private float discount() { | |
float discount; | |
discount = 0 ; //initialization is in new line | |
if (unitPricePerQuantity() >= 100) { | |
discount = unitPricePerQuantity() * 10 / 100; | |
} | |
return discount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment