P-group of nilpotency class less than p implies exponent is maximum of orders over any generating set

Statement
Suppose $$p$$ is a prime number and $$P$$ is a fact about::nilpotent p-group (for instance, a finite p-group, i.e., a group of $$p$$-power order) such that the fact about::nilpotency class of $$P$$ is less than $$p$$. In other words, $$P$$ is a fact about::p-group of nilpotency class less than p.

Suppose $$S$$ is a generating set for $$P$$. Then, the exponent of $$P$$ is the maximum, over the elements of $$S$$, of the orders of the elements.

In particular, if $$P$$ is nontrivial and has a generating set comprising elements all of which have order $$p$$, then $$P$$ is a group of prime exponent, i.e., the exponent of $$P$$ is exactly $$p$$.