Proverbs 15:21 NKJV
Folly is joy to him who is destitute of discernment, but a man of understanding walks uprightly.
Solomon points out here that when we choose to live foolishly, it is because of a lack of understanding. On the other hand, when we have understanding we choose the upright way. Ignorance about the true consequences of sin and wrong choices causes a person to live without purpose. Understanding enables us to choose to do what is right in the eyes of God.