In trail-and-error learning,an animal tries to do something many times before it is successful.
A first,it uses almost anything in its nest: leaves and grass stones,pieces of glass, or empty cans.
With experience, it learns that leaves ans grass make a more comfortable nest than stones or glass.
Of course, this learning happens faster if there is motivation, such as hunger or a need for comfort.