3 ms·
Yoda conditions
- parvenu74 8y agoNot every language throws an exception if you forget to use a double-equals sign: if (iCounter = 10) { ... } In these cases you get an assignment and the value 10 is emitted, which in C, C++, JavaScript, and other languages is simplified in the if statement to "not 0" and, therefore, true. However, if you write: if (10 = iCounter) { ... } you get a compile error. In general, any practice which allows bugs to surface earlier than later will allow you to complete a project faster and yield a better result as well.