| ▲ | Luminary099 5 days ago | |||||||
Huh, I remember actually being taught this at school, but they never bothered to give (or I never bothered to remember) an example of a programming language that actually named void functions differently or indeed why it couldn't just be a void function. Looking at it now, it seems to be a difference inherited from mathematics, which would also explain why it's in Fortran too. | ||||||||
| ▲ | adrian_b 4 days ago | parent [-] | |||||||
The main difference between functions and subroutines in Fortran and other ancient programming languages is not the fact that subroutines do not have a return value. The functions of Fortran are what would be called pure functions in C (which can be marked as such with compilers that support C language extensions, like gcc). The pure functions cannot modify any of their arguments or any global variable, and they must be idempotent, which is important in program optimization. | ||||||||
| ||||||||