Lecture 3
Style guidelines
Reserved words should be in upper case
Use indentation to make code more
readable
Identifier - can be a name for a
Variable
Constant
Function
Package
Procedure
Parameter modes
IN
- copy – pass by value - actual
parameter must have a value
OUT - result – actual parameter doesn’t have to
have a value
IN OUT – pass by value/result – similar to pass by
reference but not identical
in pass by reference, changes
made to formal parameter are immediately
reflected in actual
parameter
in pass by value/result,
changes made to formal parameters are not
reflected in actual
parameter until procedure terminates normally
THUS: if procedure
terminates abnormally, no changes are made
to actual
parameters
NOTE:
even if an array’s parameter mode is IN OUT, the parameter may be passed by
reference (to avoid copying the entire array)
Argument is a
synonym for parameter
Formal parameters
– appear in the heard of functions , procedures and packages
Actual parameters
– appear in the function and procedure calls and package instantiations
(identifier : type)
^
|__ parameter mode
Functions
return a single value
Formal parameter mode should always be IN
Procedures
return zero, one or many values and parameters may be IN, OUT, or IN OUT
headers for
function and procedure specifications end in a semi-colon ;
headers for
function and procedure bodies end in the reserved word IS
Code examples
discussed in class are available as .txt files
- let me know if you can’t access
them