How to check an entry is in a section within a for loop I need to display different information depending on the section the entry comes under when I'm displaying all entries within a loop.
Use case - I have a feed which will pull in all entries such as 'Projects' and 'Events' both are sections set up as channels.
I need to display different information relating to each Entry on the front end as they have different fields.
So I need to check if the entry belongs to 'projects' or 'events' within the loop. I can't seem to achieve it.
Current code:
{% for entry in craft.entries.authorId(authorIds).orderBy('dateCreated desc') %}
                        
      {% if entry in craft.entries.section('projects') %}

      Do something
    
      {% elseif entry in craft.entries.section('events') %}

      Do something different

      {% endif %}

{% endfor %}

This displays nothing? Any help?
Thanks
Check against entry.section.handle:
{% for entry in craft.entries.authorId(authorIds).orderBy('dateCreated desc').all() %}
                        
      {% if entry.section.handle == 'projects' %}

         Do something
    
      {% elseif entry.section.handle == 'events' %}

         Do something different

      {% endif %}

{% endfor %}