Funciones
Funciones
functions
Modularity
A program can contain other functions and can also refer to functions
that are in other files. These functions or modules are sets of
statements that are used to perform an operation or calculate a value.
A method can operate on data that is contained within the class (remembering that
an object is an instance of a class - the class is the definition, and the object is an
instance of that data).
A method is on an object.
These have a value when the function is executed, but their value is not
retained on completion of the function
Each module can be written and tested separately from the rest
of the program. After a module has been tested, it can be used in
a new program without having to test it again.
There are a lot of modules that only contain a very small function.
Using many small modules will add overhead to the build system,
increasing the size of the package.
Some codes almost never change. In those cases, there may not
be much point in trying to make it look cleaner or with abstract
logic if just using it already works fine.
function_name(parameter declaration)
{
sentences;
commands;
return expression;
}
The declaration of the parameters represents the information
that is being passed to the function.
function call
Parameters by value have that name because what the subprogram receives
are nothing more than copies of the data values that the calling program
passes to it. Therefore, if we modify any of these values in the procedure,
the original data will remain unchanged.
Parameters by reference
https://users.dcc.uchile.cl/~lmateu/CC10A/Apuntes/bibstd/ind
ex.html
https://interpolados.wordpress.com/2017/03/07/bibliotecas-
de-java/