Loop through fields from 'single' I have a structure for different categories like salad, soup, main course and so on. Basically they share the same fields - but I want to be able to have dynamic singles based on those structures. For example I have a MainMenu-Single where I than can select entries from salads, soups, main courses and so on. 

But is there a way to loop through all the fields in that single?

I tried:

{% for category in craft.entries.section('foodMenuCategories') %}
    {% if entry.{category} is defined %} 
       ...


Sadly that doesn't work.
I think there's a few ways you can do this with twig.

You should be able to check whether the category slug exists as an attribute on the entry object:

{% for category in craft.categories.group('foodMenuCategories') %}
    {% if category.slug in entry.getAttributes|keys %} 
        ...


Or by using the category slug in an array accessor:

{% for category in craft.categories.group('foodMenuCategories') %}
    {% if entry[category.slug] is defined %}
       ...


Or whether the getAttribute() method on the entry model returns anything truthy for that handle:

{% for category in craft.categories.group('foodMenuCategories') %}
    {% if entry.getAttribute(category.slug) %} 
        ...


It's also important, that the slug is the same in every language!