3 ms·
Oh, I was only commenting on the use of the variable to store and label a condition. For example, I prefer: var insideEventTime = time > start && time < end
by seanwilson 11y ago
Oh, I was only commenting on the use of the variable to store and label a condition.
For example, I prefer:
var insideEventTime = time > start && time < end;
if (insideEventTime)
...
To this:
// When inside event time
if (time > start && time < end)
...
I find comments frequently become inaccurate compared to function and variable names.
- RussianCow 11y agoI understand what you're saying, but I can see certain devs having a problem with introducing extra variables only to use them in a single conditional. Not that I agree with that, but that's the only reason I can come up with.
- seanwilson 11y agoWhat's wrong with introducing an extra variable compared to introducing a comment?
- RussianCow 11y agoWell, many developers will eschew the comment as well. :)