What is the meaning of [An idle brain is the devil’s workshop]

If you’ve nothing to do, you’ll likely think of mischief.

Example: The kids should be kept busy during the summer break. Otherwise, you know an idle brain is devil’s workshop.