Workshop › Candy Crush-style Match 3 › Step 11 of 29
No match, no swap
What we are doing
A swap only counts if it makes a match. trySwap swaps, looks with findMatches, and if there is none, swaps back
and says no.
```js
swap(a, b)
if (findMatches().size === 0) {
swap(a, b) // no match: the gems go back
return false
}
return true
```
What it means
After swapping, findMatches().size is how many matched cells there are.
If there are none, swapping the same two again puts them back, and trySwap returns false, so the listener
treats the click like any other and keeps the selection logic.
Your turn
In trySwap, between swap(a, b) and return true, write the if block.