@mastermind@lemm.ee to Programmer Humor@lemmy.ml • 2 years agowhy not a,b or x,y?lemm.eeimagemessage-square98fedilinkarrow-up1670arrow-down143
arrow-up1627arrow-down1imagewhy not a,b or x,y?lemm.ee@mastermind@lemm.ee to Programmer Humor@lemmy.ml • 2 years agomessage-square98fedilink
minus-square@atimholt@lemmy.worldlinkfedilink7•2 years 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-square@LeFrog@discuss.tchncs.delinkfedilink4•2 years ago a plural noun sheep.each do |sheep| sheep.baaah end Oh shit :D
minus-square@FalseDiamond@sh.itjust.workslinkfedilink1•2 years 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.