decrement method

void decrement()

Decrements the skip value by the number of items to take, ensuring it doesn't go negative.

Implementation

void decrement() {
  if (skip - take >= 0) {
    skip -= take;
  } else {
    skip = 0; // Prevent skip from becoming negative
  }
}