4 ms·
Mostly like if I submitted some code for review and peppered it with underscores because "I don't care about those variables" I'm pretty sure it'd come back to
by redleggedfrog 10y ago
Mostly like if I submitted some code for review and peppered it with underscores because "I don't care about those variables" I'm pretty sure it'd come back to me with a remark about starting to care.
At the point your writing code you don't care about, something might be wrong.
- johncolanduoni 10y agoDo you ever write an if statement where you don't check one of the fields of an object, or a method call where you ignore a return value? If so, how is this any different?
- bschwindHN 10y agoWhen working with an object, you don't always care about all of its properties. If it's packed in a certain way (tuple, Optional wrapper, etc.) that is easy to unpack with destructuring, then you might use an underscore to say "this is how it's structured, but I don't care about the particular value it has so please don't bind it to a variable." If you bound it to a variable and didn't use it, it'd be the same as declaring an unused variable.