Re: newbie doesn't understand why's example

fr dave:

all of you, have all been some help here…but i’m still confused and

i’m not trying split hairs here but what’s in the syntax of

end.join(sep) or foo=foo.join(sep) that ruby doesn’t

recursively recall

arraymine’s join… another words based on previous why’s (or other

tutorials that i’ve seen)

def fact(n)

if n=1 return 1

else

return n*fact(n-1)<<<<what’s the difference in the syntax from

‘end.join(sep)’

end

end

it’s still recalling the function’s name…

you’ll have to think ruby or oo, at least. remember, methods in ruby/oo
are messages to receivers, and ergo they cannot stand alone. they may
have the same name, but since they are applied (or belongs) to a
different object, they are diff. ergo, you can create your own #join
method, wc can be totally different fr other ruby’s builtin #join
methods. ruby will apply the #join method you specify by it’s context,
meaning, where you applied the method in the first place. So, if you use
the #join method, as yourself, “join what?”.

check the diff/context of the ff:

x.join
[1,2,3].join
end.join
{||}.join
do||;end.join
self.join
join

some of these do not make sense (as they stand alone), but you’ll have
to find that out for yourself why.

if you can grasp the concept of receivers/objects, then, you’ll be
ready…
the pickaxe book is great intro and so is slagell’s 21 days…

hey, i’m a nuby, too.

kind regards -botp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs