---
id: 69d048937c7bb4b4c22ebb18
title: Step 8
challengeType: 1
dashedName: step-8
---

# --description--

Now it is time to process attendees through the gate. Inside the `while` loop:  

- Decrement `currentTickQueue` by 1 to show one attendee has passed. Use the decrement operator (`--`).
- Increment `processed` by 1 to track how many attendees were processed. Use the increment operator (`++`).

# --hints--

Inside your `while` loop, you should decrement `currentTickQueue` using the decrement operator `--` and increment `processed` using the increment operator `++`.

```js
const rawFuncStr = __helpers.removeJSComments(processGateFlow.toString());
const opsRegex = /\s*processed\+\+\s*;?\s*currentTickQueue--\s*|\s*currentTickQueue--\s*;?\s*processed\+\+/;
assert(
  opsRegex.test(rawFuncStr),
  "Inside your while loop, `processed++` and `currentTickQueue--` must appear next to each other, separated by a semicolon or newline."
);

const cleaned1 = __helpers.removeWhiteSpace(rawFuncStr);
const viableSolutions1 = [
  "processed++;currentTickQueue--;}}",
  "processed++currentTickQueue--;}}",
  "processed++;currentTickQueue--}}",
  "processed++currentTickQueue--}}",
  "currentTickQueue--;processed++;}}",
  "currentTickQueue--processed++;}}",
  "currentTickQueue--;processed++}}",
  "currentTickQueue--processed++}}"
];
const endsCorrectly1 = viableSolutions1.some(sol1 => cleaned1.endsWith(sol1));
assert(
  endsCorrectly1,
  "Your function must end with the while loop and both increment and decrement operations inside of it."
);

const cleaned2 = __helpers.removeWhiteSpace(__helpers.removeJSComments(code));
const viableSolutions2 = [
"while(currentTickQueue>0&&processed<gate.capacity){processed++;currentTickQueue--;}}",
"while(currentTickQueue>0&&processed<gate.capacity){processed++currentTickQueue--;}}",
"while(currentTickQueue>0&&processed<gate.capacity){processed++;currentTickQueue--}}",
"while(currentTickQueue>0&&processed<gate.capacity){processed++currentTickQueue--}}",
"while(currentTickQueue>0&&processed<gate.capacity){currentTickQueue--;processed++;}}",
"while(currentTickQueue>0&&processed<gate.capacity){currentTickQueue--processed++;}}",
"while(currentTickQueue>0&&processed<gate.capacity){currentTickQueue--;processed++}}",
"while(currentTickQueue>0&&processed<gate.capacity){currentTickQueue--processed++}}"
];
const endsCorrectly2 = viableSolutions2.some(sol2 => cleaned2.endsWith(sol2));
assert(
  endsCorrectly2,
  "Your while loop must have both, and only both, of the increment and decrement operations inside it."
);
```

# --seed--

## --seed-contents--

```js
const morningGates = [
  { id: "North", capacity: 5, queue: [3, 6, 2, 4] },
  { id: "East", capacity: 3, queue: [2, 4, 3, 5] },
  { id: "South", capacity: 4, queue: [1, 2, 3, 1] },
  { id: "West", capacity: 2, queue: [4, 1, 2, 3] },
];

const nightGates = [
  { id: "North", capacity: 4, queue: [6, 2, 5, 1] },
  { id: "East", capacity: 2, queue: [3, 3, 4, 2] },
  { id: "South", capacity: 5, queue: [2, 1, 2, 3] },
  { id: "West", capacity: 3, queue: [5, 2, 1, 4] },
];

function initializeThroughput(gates) {
  const summary = {};
  for (const gate of gates) {
    summary[gate.id] = 0;
  };
  return summary;
}

function processGateFlow(gate, tickIndex) {
  let currentTickQueue = gate.queue[tickIndex];
  let processed = 0;
  while (currentTickQueue > 0 && processed < gate.capacity) {
--fcc-editable-region--

--fcc-editable-region--
  }
}
```
