Great thing with function is that, if you need to change what it does, you need to do it in only one place, function itself.
For example if you want PlayerObject to do something else than "set animation to Default" now you need to change it in line 36 and in line 37, so on two places. With more conditions it would be more work.
With function, you would need to change it only in that function (conditions will point on that function).