To return an int
value (even an implict 0
) is part of the calling convention
for stand-alone programs: Zero or more string arguments are passed to the program,
and an integer value is returned which acts as an error code which might be useful
in extreme error situations if all other means of diagnosis like logging or tracing fail
because they do not work for some pathologic reason which can be indicated by that error code.
The arguments passed to the program are bound to one parameter which is visible at the \
top code level whose name is arguments
. This parameter is an array of strings,
and we can get its length
field. So our next Scaly program (not much useful either)
returns the number of arguments passed at the command line:
arguments.length
This expression actually consists of two parts: an item identified by the arguments
identifier
and the access of its length
field via the dot.