ex:
def test_rabbit(name)
puts name
}
a="rabbit"
send("test_#{a}", "peter")
----> peter
1st parameter is method name, second parameter is parameter
usage: get method from user input
note:
some_object.send( function_name, args ) is the same as
some_object.function_name(args )
沒有留言:
張貼留言