
Actual Sin Involves Consenting to the Occasion of Sin
In Catholic moral teaching, avoiding the proximate/near occasion of sin is considered a grave duty. This is because it's not enough to avoid sin itself, but rather what most likely leads to it.
The occasion of sin can be a situation, a person, a place or a circumstance that can facilitate or induce the commission of a sin.
The difference between a near opportunity and a remote opportunity is important.
The proximate/near occasion is one in which, through experience or through one's own weakness, one is very likely to fall into sin.
The remote opportunity is one that involves a modest and normally surmountable risk.
Another important difference is between a voluntary proximate/near occasion and a necessary proximate/near occasion.
A voluntary proximate/near occasion is one in which one freely exposes oneself without a reasonable reason. It must be avoided. Deciding to remain in it already constitutes a fault, at least when it concerns serious matters.
A necessary proximate/near occasion is one that cannot be easily avoided (for example, a work environment, a family obligation, etc.). In this case, one is not obligated to abandon it, but one must take all possible measures to reduce the danger: prayer, vigilance, prudence, and, if possible, modification of the situation itself.
Some important scriptural references:
He who loves danger will perish in it (Ecclesiasticus 3:27)
Watch and pray that you will not enter into temptation (Matthew 26:41)