You may or may not know, but there are differences between a function and a sub routine. A sub routine is an assignment that is carried out but doesn’t give back a result. Like a sub routine, a function is used to perform an assignment. The main difference between a sub routine and a function is that, after carrying its assignment, a function gives back a result.
Simply put, a function “returns a value” while a sub routine don’t.