Excluding an include template is there a simple way to exclude an 'include' for specific pages? 

For instance I have an include {% include "_globals/_footer" %} but I don't want it to appear on my contact and 404 pages. 
How would I exclude it? 

Thank you!
There may be a better way, including adding exclusions as an array and checking if the segment exists in the array, but what about wrapping it in an if tag? This seems to work.

{% if craft.request.firstSegment != 'contact' and craft.request.firstSegment != '404'  %}
    {% include 'layouts/partials/my-template'%}
{% endif %}


Quick update: This is very rough but an example with exclusions array (doesnt account for other segments, just an example...

{% set exclusions = ['contact','404'] %}
{% if craft.request.firstSegment not in exclusions  %}
    {% include 'layouts/partials/my-template'%}
{% endif %}