Methods and functions can't really be said to be one or the other, which is why some programming languages forgo those as keywords entirely and have different ways of defining new processes which will be run repeatedly by the program.
I avoided calling it by a specific name here because "method", "function", "subroutine", or even "banana" are all just arbitrary words which could be used to describe it.