It may just sound funny, but I wonder if it is possible with Ruby? Basically, I have a function ...
def add a,b
c = a + b
return c
end
I would like to be able to pass "+" or another operator, for example "-", into a function, so that it is something like ...
def sum a,b,operator
c = a operator b
return c
end
Is it possible?
source
share