Stained-glass programs in Gothic cathedrals

What was the primary purpose of stained-glass programs in Gothic cathedrals? Do you know of any other area
of the humanities, besides religion, that uses these techniques? Develop your answer in detail. providing
examples