In a greenhouse, the sun’s heat can come in but cannot go out.
The trapped heat warms the greenhouse. This trapped heat helps in controlled growth of plants.
If there were no greenhouse gases to trap the sun’s radiation the earth would be a very cold place where we would not survive.
This trapping of heat to keep the earth warm is called greenhouse effect.