3 ms·
Pascal has the solution for that. Nested functions: procedure foobar; procedure helper1; begin end; procedure helper2; procedure subhelper2;
by benibela 7y ago
Pascal has the solution for that. Nested functions:
procedure foobar;
procedure helper1;
begin
end;
procedure helper2;
procedure subhelper2;
begin
end;
begin
end;
procedure helper3;
begin
end;
begin
end;
Only the foobar function can access the helper functions.
- dragonwriter 7y agoPascal is hardly unique in that; many languages have nested functions, and every language that has first class functions and local variables/constants has the equivalent of nested functions (potentially with even narrower scope than a whole function) even if it doesn't have a specialty nested function declaration syntax.
- networkimprov 7y agoSince nested functions don't create new API, amen.