jack jones wrote in post #1018418:
First of all thank you very much 7stud
okay I got the method but I had a question how would Ruby know what’s in
the [ ] and what’s out of them
for example :
Well, you could play around with the method and find out.
class Dog
@array = []
def []=(arg1, arg2, arg3)
array[arg1 + arg2] = arg3 # any operation
end
endd = Dog.new
d.abc(‘hello’)
d.[1,2]= 3or
d.[1] = 2, 3
we have 3 args where to put each??
Are you sure you have 3 args?
x = 10, 20, 30
p x
–output:–
[10, 20, 30]
How many ‘things’ were output for x?