S
Sard Aukary
Some methods like
def change(word)
word[0]='e'
end
a="affluent"
puts a
change(a)
puts a
alter the original object outside of the method, where as others don't.
def change(word)
word="fish"
end
a="cow"
puts a
change(a)
puts a
Why the change in behaviour, what determines it? Is the only way I can
write methods that change the original object by using the Ruby methods
that do this?
def change(word)
word[0]='e'
end
a="affluent"
puts a
change(a)
puts a
alter the original object outside of the method, where as others don't.
def change(word)
word="fish"
end
a="cow"
puts a
change(a)
puts a
Why the change in behaviour, what determines it? Is the only way I can
write methods that change the original object by using the Ruby methods
that do this?