4 ms·
"CONST == variable" is called a 'Yoda condition'. More information on this can be found at http://united-coders.com/christian-harms/what-are-yoda-conditions ht
by Luyt 16y ago
"CONST == variable" is called a 'Yoda condition'.
More information on this can be found at http://united-coders.com/christian-harms/what-are-yoda-conditions http://united-coders.com/christian-harms/what-are-yoda-condi... , which describes its uses and advantages. I tried to use them a while, but not anymore, because I find them unnatural; like reading backwards. In my opinion, it's more logical to first introduce what is being compared instead of some value which will be compared against. This is especially true if you revisit the code after a few months.
- pfedor 16y agoFurthermore, for many year now the compilers have been able to warn you if you use = instead of ==.