[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02706] X++?

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-05-10 14:00:52 UTC
List: ruby-talk #2706
My (daily :) contribution to the sudden burst of traffic: I start yet
another thread...

I got an idea from http://www.pragprog.com:8080/rubyfaq/rubyfaq-5.html#ss5.3
and thought to try. I didn't manage to make "auto(in|de)crement" working so
could somebody help here? Does this contain some errors or is the idea
wrong?

class Fixnum
  def ++
      self = self + 1
  end
end

def Fixnum.--
    self = self - 1
end

a = 1
print a,"\n"
a.++
print a,"\n"
a.--
print a,"\n"

If this is a working idea and the code should work, I have to ask it again.
Should this really work?

	- Aleksi

In This Thread

Prev Next