News for hackers. Stuff that matters.
Re:Hello Ruby – Almost there by yellowapple on Monday August 03, 2015 @06:35PM (#10000368)
> To me that appears to be the strangest way to express a loop in any language I've used (and I've used a lot of them).

How is it strange? Feels rather intuitive to me: "Do this 100 times".

> It also really bothers me that in ruby you can invoke a function on a null value to see if its null (myvar.nil?). That's really messed up...

Again: how so? `nil` is just another object, so why shouldn't it have a method telling us if it's nil?

Of course, if you don't like it, you could check to see if it equals `nil`, or you can check if its class is equal to or is a subclass of `NilClass`. Like Perl, There's More Than One Way To Do It (TM).

There are no comments on this comment yet.