SN 44.10 Ānanda Sutta: To Ānanda

Vacchagotta the wanderer asks “Is there a self?” - the Buddha is silent.
“Is there no self?” - again the Buddha is silent.
Vacchagotta gets up and leaves having received no reply.

Ānanda asks about it and gets this explanation. The Buddha says that answering ‘yes’ or ‘no’ would be siding with either the eternalists or the nihilists and would not be consistent with his teaching that all phenomena are non-self.

There is more discussion of this on the Core Sutras page.

Full text