Instruction
List Operations (continued)
Explanation
Text:
INSERT (list, i, value)
Block:
INSERT list, i, value
Text:
APPEND (list, value)
Block:
APPEND list, value
Text:
REMOVE (list, i)
Block:
REMOVE list, i
Text:
LENGTH (list)
Block:
LENGTH list
Any values in list at indices greater than or
equal to i are shifted to the right. The length of
list is increased by 1, and value is placed at
index i in list.
The length of list is increased by 1, and
value is placed at the end of list.
Removes the item at index i in list and shifts
to the left any values at indices greater than i. The
length of list is decreased by 1.
Evaluates to the number of elements in list.
Text:
PROCEDURE name (parameterl,
parameter2, ...)
{
<instructions>
}
Block:
PROCEDURE name parameter1,
Text:
instructions
parameter2,...
PROCEDURE name (parameterl,
parameter2, ...)
{
<instructions>
RETURN (expression)
}
Block:
PROCEDURE name parameterl,
parameter2,...
instructions
RETURN expression
Procedures
A procedure, name, takes zero or more
parameters. The procedure contains programming
instructions.
A procedure, name, takes zero or more
parameters. The procedure contains programming
instructions and returns the value of
expression. The RETURN statement may
appear at any point inside the procedure and causes
an immediate return from the procedure back to the
calling program.