Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are mentions of 'methods' but no actual example of one. #3

Open
GBH opened this issue Mar 27, 2012 · 0 comments
Open

There are mentions of 'methods' but no actual example of one. #3

GBH opened this issue Mar 27, 2012 · 0 comments

Comments

@GBH
Copy link

GBH commented Mar 27, 2012

I think it would be a great idea to explain exactly what a method is right after introducing Objects.
99.next looks like magic. But if you show that it's actually a method that can look like this:

class Integer
  def next
    self + 1
  end
end

... it removes some of the mystery. Plus there are opportunities to use methods in later examples, like n bottles of beer on the wall. Why start with 99? Pass whatever you want into a method. Even better, recursive method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant