Hacker News new | ask | show | jobs
by Narishma 2923 days ago
I seem to recall something similar in an old language (maybe Pascal?) where the way to return something was to assign it to the name of the function.
2 comments

Fortran does this (still does in F2008). But usually I end up using subroutines instead, since I want the code in question to modify more than one object. Functions can only return one object, and the overhead of packing/unpacking to a struct is annoying.

What Fortran really needs to get is first-class string handling and saner IO. Apart from that being a pain, modern Fortran is a nice language to use.

Pascal you can set and return the "result" variable in a function without declaring it. You can also use the functions name to do the same