this story may be unpopular in Sunday school but it's important here is our first encounter with the levirate marriage. levirate is from the Latin levir (“brothers wife”) in Hebrew the verb is yavam (“to consummate a marriage with a brother in Law”), related to y’vamah (brother’s widow”). the law is this; if a brother dies without leaving offspring his surviving brother marries the widow (Deuteronomy 25:5-10) their child will carry on the name and inheritance of the deceased brother. This is why Onan wasted his semen. He didn't want to impregnate Tamar tomorrow and thus give offspring to his brother. He wanted all the inheritance to himself.