Researchers in both cognitive science and mathematics education emphasize the importance of comparison for learning and transfer. However, surprisingly little is known about the advantages and disadvantages of what types of things are being compared. In this experimental study, 162 seventh-and eighth-grade students learned to solve equations (a) by comparing equivalent problems solved with the same solution method, (b) by comparing different problem types solved with the same solution method, or (c) by comparing different solution methods to the same problem. Students' conceptual knowledge and procedural flexibility were best supported by comparing solution methods and to a lesser extent by comparing problem types. The benefits of comparison are augmented when examples differ on relevant features, and contrasting methods may be particularly useful in mathematics learning.