hey fily -
i'm not the best person to answer this question (as i'm really
something of a newb myself,) but i'll get you started...
every method in ruby returns a value (even if it is nil, thus all the
=>nil's in irb.) by default, the value that a method returns is the
LAST statement evaluated - which is something to be aware of.
note that for the example you have shown this works just as well:
def multiply(val1, val2 )
val1 * val2
end
value = multiply( 10, 20 )
puts value
#=> 200
while there are really times when you want to use 'return,' (which
surely someone else can better explain,) generally speaking, the last
statement evaluated in your method is what is returned.
-j
--
Posted via http://www.ruby-forum.com/.