What’s the best way to pass a method and a method parameter to another method?
Is there a better way to do the following?
def method1(name) return 'Hello ' + name def method2(methodToCall, methodToCallParams, question): greetings = methodToCall(methodToCallParams) return greetings + ', ' + question method2(method1, 'Sam', 'How are you?')
You could do it this way:
You can of course pass some variables in the method() call too: