Receiving the Holy Spirit

Receiving the Holy Spirit

I have a question based on John 20:22, “And when He had said this, He breathed on them and said to them ‘receive the Holy Spirit’.” But the Holy Spirit was not given until the day of Pentecost, so how could the Lord speak these words without the event taking place immediately?