Why is attention important for memory?

Attention helps the brain encode an experience. When attention is divided, the resulting memory may be weak or incomplete from the beginning.