Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ruby face palm
#2
It's because parenthesis are optional for calling methods in ruby, so for times like this, it isn't obvious whether you're passing arguments to path.length(), or if you're operating on it's result. You can add parenthesis to all three of those, and they'll all do the same thing.

Also, the do loop takes a function, the |x| syntax is ruby's version of lambda. It's been a while since I've ruby'd, but I'd be willing to be the do had an "end" afterward, with some sort of function body that used the index.

Ruby's an alright language.
Reply


Messages In This Thread
Ruby face palm - by Mekire - May-06-2017, 02:19 PM
RE: Ruby face palm - by nilamo - May-09-2017, 09:42 PM
RE: Ruby face palm - by Mekire - May-09-2017, 10:08 PM
RE: Ruby face palm - by micseydel - May-09-2017, 10:17 PM
RE: Ruby face palm - by Ofnuts - May-11-2017, 07:46 PM
RE: Ruby face palm - by nilamo - May-11-2017, 06:23 PM
RE: Ruby face palm - by micseydel - May-11-2017, 09:41 PM
RE: Ruby face palm - by nilamo - May-11-2017, 09:48 PM
RE: Ruby face palm - by micseydel - May-11-2017, 10:23 PM
RE: Ruby face palm - by Mekire - May-11-2017, 10:29 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020