“And you shall not stray after your hearts and your eyes!” (Bamidbar 15:39)
It is a negative commandment that one may not stray after the thoughts of the heart and the view of the eyes, as it says “And you shall not stray after your hearts and your eyes!”. The point of this commandment is that we should not concentrate our thoughts to think about things which are the opposite of the knowledge which the Torah is built upon, as from this one can come to false ideas and denial of Hashem. Even if a bad idea comes to a person, he should shorten his thinking about them, and think about the ways of the Torah which are true and good. Similarly, a person should not chase after the view of his eyes. This includes that one may not chase after the pleasures of this world, for their end is bad and enough degradation and anger.
The root of this commandment is obvious, for by doing this a person will guard himself from sinning to Hashem all his days, and this commandment is a great foundation in the religion, for bad thoughts are the fathers of all impurity, and the actions are their children. You must know that that which Chazal said that “A sin draws another sin and a good deed draws another” means that if one time you let yourself follow your desires you will end up doing it another time, whereas if you are strong and control yourself even once, it will become easier to do so many times. Those who drink wine will never be satisfied with their wine. Rather, the more they drink, the more they want. This is true about all desires that when one indulges them the evil inclination will get stronger day by day, whereas when one refrains from them he will be happy with his lot every day, and he will see that Hashem made man straight.
This commandment applies in all places and at all times, both to men and to women. One who deliberately thinks thoughts which cause him to leave the complete clean way of the Torah and to enter the ways of the deniers and confusers, and someone who follows his eyes by chasing after the pleasures of this world, without any sort of good intention, transgresses this prohibition. One does not receive lashes for this commandment, as one cannot warn him, as it is undefined.