How (from Darwin’s point of view) did the protective green coloration of the body appear in brown caterpillars

How (from Darwin’s point of view) did the protective green coloration of the body appear in brown caterpillars, which switched to feeding on green leaves?

1) brown caterpillars switched to feeding on green leaves. Mutations constantly appeared in the population; among the many mutant individuals, individuals with a green color appeared in color.
2) in the struggle for existence, green caterpillars had an advantage, they were less pecked by insects
3) under the influence of EO those caterpillars survived that had useful traits – green color, they gave offspring, their number gradually increased
4) in subsequent generations this process continued, and the body color of the caterpillars more and more corresponded to the background of the environment.

Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.