A fundamental question relating to animal behaviour is how animals learn; in particular, how they come to associate stimuli with rewards. Numerous empirical findings can be explained by assuming that animals use some mechanism similar to the Rescorla–Wagner learning rule, which is a relatively simple and highly general method of updating the associative strength between different stimuli. However, the Rescorla–Wagner rule is often not optimal, which raises the question of why a rule with such properties should have evolved. We consider the evolution of learning rules in a simple environment where there exists an optimal rule of similar complexity to the Rescorla–Wagner rule. We show that because the Rescorla–Wagner rule is less sensitive to changes in its parameters than the optimal rule, there is a wider range of parameter values over which the rule structure is initially viable. Consequently, the Rescorla–Wagner rule can be favoured by natural selection, ahead of other rules which are more accurate.