“This is what I would teach you. Choose from among the sacred music of the Church a favorite hymn, one with words that are uplifting and music that is reverent, one that makes you feel something akin to inspiration. Go over it in your mind carefully. Memorize it. Even though you have had no musical training, you can think through a hymn.
“Now, use this hymn as the place for your thoughts to go. Make it your emergency channel. Whenever you find theses shady actors have slipped from the sidelines of your thinking onto the stage of your mind, put on this record, as it were. As the music begins and the words form in your thoughts, the unworthy ones will slip shamefully away from your mind. Because it is uplifting and clean, the baser thoughts will disappear. For while virtue, by choice, will not associate with filth, evil cannot tolerate the presence of light.
“In due time you will find yourself, on occasion, humming the music inwardly. As you retrace your thoughts, you discover some influence from the world about you encouraged an unworthy thought to move on stage in your mind, and the music almost automatically began.
“Once you learn to clear the stage of your mind of unworthy thoughts, keep it busy with learning worthwhile things. Change your environment so that you have things about you that will inspire good and uplifting thoughts. Keep busy with things that are righteous.
“Another thing will help both to prevent and to overcome such habits. At times of special temptation skip a meal or two. We call that fasting, you know. It has a powerful effect upon you physically. It diverts some of that physical energy to more ordinary needs. It tapers desire and reduces the temptation. Fasting will help you greatly. In the scriptures, fasting and prayer are generally mentioned together. Prayer is a powerful instrument to bless young men. If a missionary, for instance, indulges in these unworthy practices, the Spirit of the Lord will leave him. When he is prayerful and will fast, the Spirit of the Lord sustains him. He soon develops a manly restraint and worthiness.
“Resist those temptations. Do not tamper with your body. If you have already, cease to do it – now. Put it away and overcome it. The signal of worthy manhood is self-control.”
~Boyd K. Packer, General Conference – 1976, “To Young Men Only”~