mastermind@lemm.ee to Programmer Humor@lemmy.ml · 1 year agowhy not a,b or x,y?lemm.eeimagemessage-square100fedilinkarrow-up1669arrow-down143
arrow-up1626arrow-down1imagewhy not a,b or x,y?lemm.eemastermind@lemm.ee to Programmer Humor@lemmy.ml · 1 year agomessage-square100fedilink
minus-squareatimholt@lemmy.worldlinkfedilinkarrow-up7·1 year agoI like range-based for loops. You can just name the iterator after the object that it actually is. Have to be a little careful though, if the container is named a plural noun, and the natural name is the same word minus the easy-to-miss ‘s’.
minus-squareLeFrog@discuss.tchncs.delinkfedilinkarrow-up4·1 year ago a plural noun sheep.each do |sheep| sheep.baaah end Oh shit :D
minus-squareFalseDiamond@sh.itjust.workslinkfedilinkarrow-up1·1 year agoThis is one of the few things I really like about JS/TS. for (thing of things) is very legible and self documenting.
I like range-based for loops. You can just name the iterator after the object that it actually is. Have to be a little careful though, if the container is named a plural noun, and the natural name is the same word minus the easy-to-miss ‘s’.
sheep.each do |sheep| sheep.baaah end
Oh shit :D
This is one of the few things I really like about JS/TS. for (thing of things) is very legible and self documenting.