The number of individuals in a population who school is proportional to the availability of food in the banded killifish. Schooling improves the chances of finding food if there is a scarcity, while schooling increases competition unnecessarily if there is plenty available.