A yard is an area of land immediately adjacent to one or more buildings. It may be either enclosed or open. The word may come from the same linguistic root as the word garden and has many of the same meanings.
A subdivision backyard (American English)
A yard in a rural town in Germany (Hildesheim Börde)
Grass-fed cattle, saleyards, Walcha, NSW
A pen is an enclosure for holding livestock. It may also perhaps be used as a term for an enclosure for other animals such as pets that are unwanted inside the house. The term describes types of enclosures that may confine one or many animals. Construction and terminology vary depending on the region of the world, purpose, animal species to be confined, local materials used and tradition. Pen or penning as a verb refers to the act of confining animals in an enclosure.
Sheep in a pen, in Yorkshire, England
Pen for goats in Macedonia
Sheep near a dry stone sheepfold, one of the oldest types of livestock enclosure
Folding portable wire exercise pen