Just to add a bit more to this,
You typically want to use functions for code you are planning on using multiple times, as a function only gets compiled once, no matter how many times you use it. If you were to simply copy the same nodes again, they would compile twice.
Now, I’m sure you can see how in a bigger project, where a single function might be used over 50-100 times, this can affect performance.