A function returns a value and a procedure just executes commands.
The name function comes from math. It is used to calculate a value based on input.
A procedure is a set of commands which can be executed in order.
In most programming languages, even functions can have a set of commands. Hence the difference is only returning a value.
But if you like to keep a function clean, (just look at functional languages), you need to make sure a function does not have a side effect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…