4 only fits into the interval 2 < x ≤ 7 (the bottom one listed), so you only need to do the calculation as if your function was f(x) = -6.
Now this is both a simple and tricky function, f(x) = -6. It’s tricky, because there’s no x on the right side. But that’s what makes it simple, once you understand how that works.
Since there isn’t any x on the right side, the output/y-value is just always -6. There’s no calculation needed to do.
So, f(4) = -6.
Recap:
Step 1: figure out which piece of the function to use
Step 2: evaluate the function only using that piece.