You don’t know the function of the above function. In fact, it is largely because the function structure above is too simple and has no return value. You can look at slightly more complex functions to understand the construction and calling methods of the function, and you will understand. It's a function. For example, in your second method above, if you need to modify the m-th element in the name list, write this function as a function, and then attach the list and index variables when calling it. You can modify any list through this function. Elements at any position, imagine that the same operation needs to be performed several times at different locations in the code, and just call this function there.
The method you wrote cannot do anything;
You need to return
Custom function is to encapsulate many things to be done into a method that you can call anywhere.
You don’t know the function of the above function. In fact, it is largely because the function structure above is too simple and has no return value. You can look at slightly more complex functions to understand the construction and calling methods of the function, and you will understand. It's a function. For example, in your second method above, if you need to modify the m-th element in the name list, write this function as a function, and then attach the list and index variables when calling it. You can modify any list through this function. Elements at any position, imagine that the same operation needs to be performed several times at different locations in the code, and just call this function there.