What are procedures in Pascal?

Procedures in Pascal are sub-programs that return a group of results. They are defined using the procedure keyword.

Definition

The following snippet shows how procedures are generally defined:

procedure name(argument(s): type1, argument(s): type2, ... );
   {local declarations}
begin
   {procedure body}
end;

Arguments

Arguments create a link between the calling program and the procedure. They are also called formal parameters.

Local declarations

These refer to the declarations for variables, constants, functions, procedures, and labels whose scope is limited to the procedure itself.

Procedure body

This is where the procedure defines its implementations and calculations. The procedure body is enclosed between the keywords begin and end.

Code

The following code shows the implementation of a procedure in Pascal:

program Example;
var 
   a, b, max: integer;

procedure findBigger(x, y: integer; var m: integer); 
{ Finds the maximum of the 2 values }
begin
   if x > y then
      m := x
   else
      m := y;
end; { end of procedure findBigger } 

begin 
    a = 2
    b = 3
    findBigger(a, b, max); {procedure call}

    writeln(' The larger number is: ', min); {prints 3}

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved