Procedures
If you’re particular about names:
- The name “function” often implies zero side-effects. Just compute and return a value based on any args passed in, regardless of the state of any global variables. And no modifying any global variable either.
- The name “subroutine” often implies all side-effects, possibly accounting for values of globals, modifying globals, and may or may not return a value.
“Procedure” in a general term that covers both, and that’s what Odin uses. Ex.:
package my_pkg
import "core:fmt"
main :: proc() {
n, m := 2, 3
ans := foo(n, m)
fmt.println(ans)
}
foo :: proc(num_1: int, num_2: int) -> int {
return num_1 + num_2
}