Aluminum foil is used in cooking for several purposes. It can be used to cover food while baking to prevent it from drying out or to lock in moisture. Foil can also be shaped into packets for steaming or baking foods, such as fish or vegetables, which helps to retain flavors. It's used to line baking sheets to prevent food from sticking and to make cleanup easier. Additionally, aluminum foil is used for roasting meats or vegetables, as it can reflect heat and help cook food evenly. It's also used to create makeshift containers or to wrap food for easy handling and portion control.