krainboltgreeneKurtis R.G.
My nephew is learning the wrong Ruby practices via Learn Ruby The Hard Way by @zedshaw…And yet still grateful for it's existence.
krainboltgreeneKurtis R.G.
@zedshaw None of that so far, but I wonder if you realize there is an actual real difference (that can catch newbies) between #each and for?
krainboltgreeneKurtis R.G.
@zedshaw He's not at loops yet, so no. I'm only talking about it because you brought it up. Here's the diff: gist.github.com/3385139
krainboltgreeneKurtis R.G.
@zedshaw I'm sure you'll figure out the reason, but just in case: for-loops stay in same scope, in 1.9 blocks have their own scope.
zedshawzedshaw
@krainboltgreene Oh, ok 18.rb is for Ruby 1.8. Alright, so now why does that matter? Is there an exercise that trips people up with that?
zedshawzedshaw
@krainboltgreene So what you're saying is, Ruby has a broken for-loop scope and they only fixed .each in 1.9. Sounds like Ruby being Ruby.
krainboltgreeneKurtis R.G.
@zedshaw They fixed blocks, not specifically each, and yeah, it sucks. That said apparently because of this for-loops are "faster" (heh)
krainboltgreeneKurtis R.G.
@zedshaw Sure, I'll give it a shot, but I want to reiterate it's mostly minor things that I've been able to point out to him.
zedshawzedshaw
@krainboltgreene Ok, like what? If it's just little things then "wrong Ruby practices" is the wrong wording. If they're huge then tell me.