PROCEDURE proecdure-name signature "="
declarations
BEGIN
statements
END procedure-name ";"
procedure-name = identifier
A procedure declaration is composed of an identifier, a signature (see section Procedure Types), optional local declarations, and statements. The identifier at the end of the procedure must match the id at the beginning. Declarations made in a procedure are local to the procedure: they exist only while the procedure is executing.
If the procedure signature specifies a result type, the procedure is called a function procedure, and it must include a RETURN statement which returns an expression of the specified type. It is a checked runtime error for a function procedure to fail to return a result.
PROCEDURE Hello( ) =
BEGIN
IO.Put ("Hello World\n");
END Hello;
PROCEDURE Check(f: File.T) RAISES { Problem } =
BEGIN
IF file = NIL THEN RAISE Problem END;
END Check;
EXCEPTION Problem;