[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integer BASIC's "*** NO END ERR"
Paul Schlyter wrote:
> You must put an end to programs in other programming languages too.
> If you omit the final END from a Pascal or FORTRAN program, or the
> final closing brace from a C, C++, Java or C# program, the compilers
> will treat this as a compilation error, forcing you to add the
> missing END (or final closing brace), and recompile.
The END statement is more akin to an exit() call (in C/C++) than a closing
brace. An exit() call means "terminate execution now".
In compiled languages like C/C++, braces (etc) are part of the syntax, and
are (usually) strictly required. The use of statements like END or calls
like exit() are simply part of the language's runtime services, and can
hardly be required - many programs never stop! (Although on modern systems
they usually have some contract with the OS to be asked to shut down
nicely.)
In most interpreted languages - like JavaScript, shell/batch files, Perl,
etc - no explicit "end" statement is required. When the interpreter runs out
of things to interpret, it stops nicely and hands execution back to the
host.
(Nothing wrong with Integer Basic's requirement for END - it probably cut
down on errors when subroutines were later added to the "end" of the source.
I'm certain I made mistakes like that.)
Joshua