Remove Assignments to Parameters

The code assigns to a parameter.

Use a temporary variable instead.

int discount (int inputVal, int quantity, int yearToDate) {
  if (inputVal > 50) inputVal -= 2;

image/svg+xml

int discount (int inputVal, int quantity, int yearToDate) {
  int result = inputVal;
  if (inputVal > 50) result -= 2;