[It is] good for me that I have been afflicted
 The good and profit of which he had observed before; (See Gill on Psalms 119:67). The following end being also answered thereby, 
 that I might learn thy statutes;
 to understand them, and to keep them. Afflictions are sometimes as a school to the people of God, in which they learn much both of their duty and of their privileges; and when they are teaching and instructive, they are for good; see ( Psalms 94:12 ) .