One of the challenges English speakers face when learning German is expressing likes or dislikes. It’s not uncommon for learners to find it tricky to differentiate between saying they like doing something and saying they like something, as English does not distinguish between them. When expressing a liking for an object, German uses the transitive verb mögen; while expressing a liking for an action, German uses the adverb gern.
The adverb gern follows the conjugated verb in a sentence:
Ich learn gern Deutsch. Ich gehe gern spazieren.
Adverbs of time and reason precede gern:
Ich gehe morgens gern spazieren. Ich gehe morgens wegen der Ruhe gern spazieren.
The transitive verb mögen requires a direct object telling the listener what it is that we like, thereby requiring to decline the direct object in the Accusative case:
Ich mag meinen Deutschunterricht. Ich mag das Essen.
Learners progressing beyond level A1 will then come across other ways to express their like or dislike for something, with the verb schmecken, for example, which roughly translates as being to my taste. That is an intransitive verb requiring the Dative case. The difficulty for English speakers is to understand that the person liking or disliking the taste of something is now no longer the subject of the sentence but the indirect object and the food we are enjoying takes the function of the subject, being in the Nominative case:
Mir schmeckt das Essen.
The same goes for the verb gefallen. The thing we like now takes the function of the subject, and the person enjoying it is now the indirect object, hence the Dative case.
Mir gefällt der Deutschunterricht.
Expressing dislike with an adverb is done by placing nicht before the adverb gern.
Ich gehe nicht gern spazieren. Ich gehen morgens nicht gern spazieren.
When expressing dislike for something rather than an activity, then we add nicht to the end of the sentence if we are negating the entire concept or the verb:
Ich mag das Essen nicht. Mir schmeckt das Essen nicht.
Gern can be replaced by gerne, depending on preference or flow.