Algorithms and Programs 2
Algorithms and Programs 2
the call must match the number and types of of constructs such as loops XXXXXXXXX
XXXXXXXXX
/ Division < Is less than or if statements to the right
the parameters that were created when the
subroutine was originally defined. Modulus (returns Is greater than or makes it easier to see the overall structure.
% >=
remainder) equal to In some languages, (e.g. Python) indentation
Passing parameters by reference involves is mandatory, missing it out will result in
passing a pointer to the subroutine which Exponent Is less than or equal
** <= syntax errors. It is also much easier to debug
points to the original parameter (the original to
properly indented code.
data item). Any changes to the data made
within the subroutine will also be made to the TRUTH TABLE White space should be used to separate
original parameter. X Y AND OR NOT X XOR different subprograms and functions so that it
is easier to see each module (section) of code.
Passing parameters by value involves 0 0 0 0 1 0
taking a copy of the parameter and passing 0 1 0 1 1 1
that copy to the subroutine. Any changes
to the copy of the parameter inside the 1 0 0 1 0 1
subroutine do not affect the data held in the 1 1 1 1 0 0
original parameter.