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

Allows to overwrite arithmetic operators #32

Merged
merged 1 commit into from
Oct 1, 2023
Merged

Conversation

m3m0r7
Copy link
Owner

@m3m0r7 m3m0r7 commented Oct 1, 2023

supports:

class Integer
  def +(s)
    self - s
  end
  def -(s)
    self * s
  end
end

puts 10 + 10

it will show 100, not 20; because it overwrites + and - operator definitions on the Integer class which provides natural features in the Ruby.

@m3m0r7 m3m0r7 merged commit 3402c44 into main Oct 1, 2023
2 checks passed
@m3m0r7 m3m0r7 deleted the overwrite-operators branch October 1, 2023 08:55
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

Successfully merging this pull request may close these issues.

1 participant