One of the most frustrating experiences about writing a computer program is when the computer just doesn’t do what you want it to do. This is why one of the earliest lessons you learn as a computer scientist is that there really is no use in getting angry at the computer about this.
The computer does what you tell it to do. Exactly that. Nothing more. Nothing less.
It doesn’t do what you meant. It does what you said. When something doesn’t work the way you meant it to work, it means that what you said was not what you meant.
The computer is always right.
There’s really only one way of getting a computer to do what you meant: Write the code so that it says what you mean.
This is also a great rule to apply when talking to humans. Granted, you might not want to speak to humans just the way you write a program. Your audience might consider you crazy. But, you can invest just as much care in making sure that what you say is what you mean.
(Although when talking to humans, things get even more complex because communication is not about what we say but about what our audience hears.)