4 ms·
"_" is when you must assign a value, but don't want to use it. range in the for loop return 2 values (index, value). If you don't want the index, you can assig
by ominous_prime 13y ago
"_" is when you must assign a value, but don't want to use it.
range in the for loop return 2 values (index, value). If you don't want the index, you can assign it to "_" to ignore it.
http://golang.org/ref/spec#Blank_identifier http://golang.org/ref/spec#Blank_identifier
- swalsh 13y agooh! that's pretty cool.
- steveklabnik 13y agoCheck your favorite language, it probably has this feature. Ruby, Haskell, tons of them.