S
Sam Kong
Hi, all!
I've been with Ruby for a year now and am still a newbie...:-(
(I wish I were using Ruby at work.)
My question is about assigning a function to a variable.
def f
"f"
end
g = f #assigns the return value of f to g.
What I want is to assign the function to g so that I can call g instead
of f.
All I could find was
alias :g :f
I am sure there's another way to do it.
Thanks.
Sam
I've been with Ruby for a year now and am still a newbie...:-(
(I wish I were using Ruby at work.)
My question is about assigning a function to a variable.
def f
"f"
end
g = f #assigns the return value of f to g.
What I want is to assign the function to g so that I can call g instead
of f.
All I could find was
alias :g :f
I am sure there's another way to do it.
Thanks.
Sam