an.10.31 Aṅguttara Nikāya (Numbered Discourses)
With Upāli
Then Venerable Upāli went up to the Buddha, bowed, sat down to one side, and said to him:“Sir, for how many reasons did the Realized One lay down training rules for his disciples and recite the monastic code?”
“Upāli, the Realized One laid down training rules for his disciples and recited the monastic code for ten reasons.
What ten?
For the well-being of the Saṅgha and for the comfort of the Saṅgha. For keeping difficult persons in check and for the comfort of good-hearted mendicants. For restraining defilements that affect the present life and protecting against defilements that affect lives to come. For inspiring confidence in those without it, and increasing confidence in those who have it. For the continuation of the true teaching and the support of the training.
The Realized One laid down training rules for his disciples and recited the monastic code for these ten reasons.”