If you want to do something or you are doing something, and then you decide not to do or decide to stop doing for some reason, you would say 不干了。
If you want to go somewhere or you are on your way to somewhere, and then you decide not to go there, you would say 不去了。
likewise, if i am eating something, for some reason i decide to stop eating, i would say 不吃了
I know you're learning chinese now, i don't want to hear you say 不学了,太难了。 哈哈