“Now these things happened to them as an example, and they were written for our instruction” (1 Corinthians 10:11).
The “things” referenced in 1 Corinthians 10 were the sins of Israel–idolatry, immorality, and grumbling. While these things were detrimental for the Israelites, you and I can benefit from the error of their choices. The question is always one of whether we have the wisdom to learn from the mistakes of others or must we, foolishly, learn them the hard way of personal experience. We can be instructed by others or self-destruct.