public void ProcessOrder(int orderId, bool applyDiscount)
{
if(applyDiscount)
{
//Apply Discount to the order
}
// Process the order here
}
ProcessOrder(1000, applyDiscount: true);
Clean Code:
public enum DiscountOption
{
None,
ApplyDiscount
}
public void ProcessOrder( int orderId, DiscountOption discountOption)
{
if(discountOption == DiscountOption.ApplyDiscount)
{
// Apply discount to the order
}
// Process the order
}
ProcessOrder(1000, DiscountOption.ApplyDiscount);
No comments:
Post a Comment