官术网_书友最值得收藏!

Deleting old data

When you first learned how to program, one of the earliest concepts that you were taught was the variable. A variable is something that's used to store a value, so of course it's important! When you create a variable and assign its initial value, it feels like you're creating new data. This is because you are creating new data.

Then, later on in your code, you assign a new value to your variable. It's a variable, so naturally it varies. This might also seem like you're creating new data, which you are; if you assign the value 5 to your variable, then that's a new value that didn't exist before. Here's the catch: you're also destroying data. What if your variable had a value of 2 before you assigned it 5?

This might not seem like a big deal. Isn't a variable supposed to store whatever value you assign to it? Yes, variables work perfectly fine that way. They do exactly what we ask them to do. So, the problem isn't strictly that variables can change their values. Rather, it's a human limitation—we can't reason our way through the huge number of variable changes that happen in our code. This leads to some scary bugs.

主站蜘蛛池模板: 稷山县| 滦平县| 洛南县| 息烽县| 原阳县| 息烽县| 治县。| 济宁市| 友谊县| 汤原县| 扎兰屯市| 东丰县| 兴业县| 黄石市| 张掖市| 邳州市| 拜城县| 雷州市| 胶南市| 桓仁| 读书| 伊春市| 安塞县| 固原市| 天津市| 和静县| 图们市| 承德县| 伊春市| 顺义区| 遂川县| 视频| 景谷| 个旧市| 绵竹市| 元谋县| 合肥市| 奉化市| 尚志市| 成武县| 新营市|