summaryrefslogtreecommitdiff
path: root/doc/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'doc/syntax')
-rw-r--r--doc/syntax/methods.rdoc10
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc
index 58179549f3..2c01810b4c 100644
--- a/doc/syntax/methods.rdoc
+++ b/doc/syntax/methods.rdoc
@@ -109,22 +109,22 @@ operator with an <code>@</code> as in <code>+@</code> or <code>!@</code>:
Unary methods accept zero arguments.
-Additionally, methods for element reference and assignment may be defined:
-<code>[]</code> and <code>[]=</code> respectively. Both can take one or more
+Additionally, methods for element reference and assignment may be defined:
+<code>[]</code> and <code>[]=</code> respectively. Both can take one or more
arguments, and element reference can take none.
class C
def [](a, b)
puts a + b
end
-
+
def []=(a, b, c)
puts a * b + c
end
end
-
+
obj = C.new
-
+
obj[2, 3] # prints "5"
obj[2, 3] = 4 # prints "10"