Rocks can form in a variety of ways. Igneous rocks form from magma (molten rock) that has either cooled slowly underground (e.g., to produce granite) or cooled quickly at the surface after a volcanic eruption (e.g., basalt). Sedimentary rocks, such as sandstone, form when the weathered products of other rocks accumulate at the surface and are then buried by other sediments. Metamorphic rocks form when either igneous or sedimentary rocks are
heated and squeezed to the point where some of their minerals are unstable and new minerals form to create a different type of rock. An example is schist.