Skip to content

Instantly share code, notes, and snippets.

@michal-lipski
Last active December 25, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michal-lipski/6887828 to your computer and use it in GitHub Desktop.
Save michal-lipski/6887828 to your computer and use it in GitHub Desktop.
Strange behavior when extracting method
//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