---
title: "AP Computer Science Principles 3.12: Calling Procedures"
description: "Review AP CSP procedure calls, including parameters, arguments, flow of control, RETURN values, DISPLAY, INPUT, and pseudocode tracing."
canonical: "https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu"
type: "study-guide"
subject: "AP Computer Science Principles"
unit: "Unit 3 – Algorithms & Programming Fundamentals"
lastUpdated: "2026-06-09"
---

# AP Computer Science Principles 3.12: Calling Procedures

## Summary

Review AP CSP procedure calls, including parameters, arguments, flow of control, RETURN values, DISPLAY, INPUT, and pseudocode tracing.

## Guide

A [procedure](/ap-comp-sci-p/key-terms/procedure "fv-autolink") is a named group of instructions you can run again and again by calling it, instead of rewriting the same code. When you call a procedure, you pass in arguments that fill its parameters, the program runs the procedure's statements, and then control returns to the line right after the call. For [AP Computer Science Principles](/ap-comp-sci-p "fv-autolink"), track how arguments map to parameters, what the procedure changes, and where the program continues after the call.

## Why This Matters for the AP Computer Science Principles Exam

Calling procedures shows up a lot in the multiple-choice section, where you trace [pseudocode](/ap-comp-sci-p/key-terms/pseudocode "fv-autolink") and figure out what a [procedure call](/ap-comp-sci-p/key-terms/procedure-call "fv-autolink") produces or changes. You need to know how arguments map to parameters, how flow of control jumps into a procedure and comes back, and how RETURN sends a value back to where the procedure was called.

This topic also supports the [Create performance task](/ap-comp-sci-p/key-terms/create-performance-task "fv-autolink"). Using procedures with parameters is one of the clearest ways to manage complexity in your own program, and writing and calling your own procedure is something you will reuse all over [Unit 3](/ap-comp-sci-p/unit-3 "fv-autolink"). Getting comfortable with calls now makes topics like writing procedures, using libraries, and building simulations much easier.

## Key Takeaways

- A procedure is a named group of instructions that may take parameters and may return a value. Different languages call it a method or a function.
- Parameters are the input [variables](/ap-comp-sci-p/key-terms/variable "fv-autolink") in a procedure's definition. Arguments are the actual values you pass when you call it.
- Arguments match parameters by position: the first [argument](/ap-comp-sci-p/unit-3/developing-procedures/study-guide/Jhzac68HzbAilXRPuZFJ "fv-autolink") fills the first parameter, the second fills the second, and so on.
- Calling a procedure pauses the normal top-to-bottom flow, runs the procedure's statements, then returns control to the line right after the call.
- `RETURN(expression)` sends a value back to the call site and ends the procedure early; use `result ← procName(arg1, arg2, ...)` to store that returned value.
- A procedure can take zero or more arguments, so not every procedure needs parameters.

## How AP Pseudocode Represents Procedures

The exam reference sheet uses specific notation for defining and calling procedures. You do not have to memorize a real language's [syntax](/ap-comp-sci-p/key-terms/syntax "fv-autolink"), but you do need to read this notation fluently.

To define a procedure:

```
PROCEDURE procName(parameter1, parameter2, ...)
{
    <block of statements>
}
```

To define a procedure that sends back a value:

```
PROCEDURE procName(parameter1, parameter2, ...)
{
    <block of statements>
    RETURN(expression)
}
```

To call a procedure:

```
procName(arg1, arg2, ...)
```

To call a procedure and store what it returns:

```
result ← procName(arg1, arg2, ...)
```

When the call runs, `arg1` is assigned to `parameter1`, `arg2` is assigned to `parameter2`, and so on. The reference sheet also gives you `DISPLAY(expression)` to show a value followed by a space, and `INPUT()` to accept a value from the user and return it.

## Parts of a Procedure

Here is a simple program that sums two numbers without a procedure:

```
first_number = 5
second_number = 7
sum_value = first_number + second_number
print (sum_value)
```

If you wanted to sum several different pairs of numbers, you would have to rewrite these lines over and over. A procedure fixes that. Here is the same idea written as a function in Python:

```
def summing_machine(first_number, second_number):
  print (first_number + second_number)
```

The names inside the parentheses, `first_number` and `second_number`, are the **parameters**. Parameters are the input variables a procedure uses to do its job. A procedure does not always need parameters; some take zero arguments.

When you **call** a procedure, the program runs the lines inside it as if they were written out at that spot. After it finishes, the program goes back to reading code in order from the line right after the call. The actual values you pass in when calling are the **arguments**:

```
def summing_machine(first_number, second_number):
  print (first_number + second_number)

summing_machine(5, 7)
# In this example, 5 and 7 are the arguments.
```

Here `5` is assigned to `first_number` and `7` is assigned to `second_number`, matching by position.

## Returning a Value

Sometimes you want a procedure to hand back a result instead of just displaying it. A **return** statement does that. It returns the value of an [expression](/ap-comp-sci-p/key-terms/expression "fv-autolink") to the point where the procedure was called, and you can store or reuse that value:

```
def summing_machine(first_number, second_number):
  value = first_number + second_number
  return (value)

answer = summing_machine(5, 7)
print (answer)

# You can manipulate the returned value too.
print (answer + 1)
```

In [AP Pseudocode](/ap-comp-sci-p/key-terms/ap-pseudocode "fv-autolink"), you assign that returned value to a variable with the arrow [operator](/ap-comp-sci-p/key-terms/operator "fv-autolink"), like `answer ← summing_machine(5, 7)`. A RETURN statement also ends the procedure immediately, so any statements after it inside the procedure do not run.

## How to Use This on the AP Computer Science Principles Exam

### Code Tracing

Most procedure-call questions ask you to determine the result or [effect](/ap-comp-sci-p/unit-5/beneficial-harmful-effects/study-guide/rErWKPcu55DLj7N7L8hZ "fv-autolink") of a call. Work through them in order:

- Match each argument to its parameter by position.
- Run the procedure's statements using those values.
- If you hit a RETURN, stop running the procedure and send that value back.
- Continue from the line right after the original call.

### Display vs Return

Watch the difference between displaying and returning. `DISPLAY(expression)` shows a value as output but does not give the call a value you can store. `RETURN(expression)` gives the call a value you can assign with `result ← procName(...)` or use in a larger expression. A question may show a procedure that returns a value but never stores or displays it, which means nothing actually appears as output.

### Create Performance Task

When you build your own program, writing a procedure with at least one parameter is a strong way to manage complexity and reuse code. Make sure you can explain in plain language what your procedure does and how its parameters change its behavior, since being able to describe how a procedure works is part of showing you understand your own code.

## Common Misconceptions

- Parameters and arguments are not the same thing. Parameters are the placeholder variables in the definition; arguments are the real values you pass in when you call.
- Argument order matters. Values fill parameters by position, so swapping the order of arguments can change the result.
- RETURN and DISPLAY are different. RETURN sends a value back to the caller; DISPLAY just shows output on the screen. A returned value is lost if you do not store or use it.
- Calling a procedure does not skip the rest of your program. Control returns to the line right after the call once the procedure finishes.
- A procedure does not have to take parameters. Procedures can take zero or more arguments.
- Code after a RETURN inside the same procedure does not run, because RETURN ends the procedure right away.

## Related AP Computer Science Principles Guides

- [3.1 Variables and Assignments](/ap-comp-sci-p/unit-3/variables-assignments/study-guide/vtJhAf5XFOkm1uHNDMvh)
- [Big Idea 3: Algorithms and Programming](/ap-comp-sci-p/unit-3/review/study-guide/eOWMqAJUdtnmttaCSlis)
- [3.18 Undecidable Problems](/ap-comp-sci-p/unit-3/undecidable-problems/study-guide/q0SSR2ddayx397Hy6ztA)
- [3.17 Algorithmic Efficiency](/ap-comp-sci-p/unit-3/algorithmic-efficiency/study-guide/jGSWIqW49BtrQ8dqCWFd)
- [3.2 Data Abstraction](/ap-comp-sci-p/unit-3/data-abstraction/study-guide/kMMTClSiHohfiaHMGFFE)
- [3.10 Lists](/ap-comp-sci-p/unit-3/lists/study-guide/mCE6meIGp5pqs1y5ym3h)

## Vocabulary

- **argument**: The actual values passed to a procedure when it is called, which correspond to the procedure's parameters.
- **flow of control**: The order in which statements are executed in a program, including how control transfers to and from procedures.
- **parameter**: Variables in a procedure that allow it to accept different input values, enabling the procedure to be generalized and reused with a range of inputs.
- **procedure**: A named block of reusable code that performs a specific task and can be called multiple times throughout a program.
- **procedure call**: A statement that executes a named procedure, interrupting sequential execution and transferring control to the procedure.
- **return values**: Values that a procedure sends back to the point where it was called.
- **sequential execution**: The execution of programming statements in the order they appear, one after another.

## FAQs

### What is a procedure in AP Computer Science Principles?

A procedure is a named group of programming instructions that may take parameters and may return a value. Other programming languages may call the same idea a function or method.

### What is the difference between parameters and arguments?

Parameters are the input variables listed in a procedure definition. Arguments are the actual values passed into the procedure when it is called, and they match parameters by position.

### What happens when a procedure is called?

A procedure call pauses the normal sequence of statements, runs the statements inside the procedure, and then returns control to the line immediately after the call.

### How do you call a procedure in AP pseudocode?

The AP reference sheet uses procName(arg1, arg2, ...) to call a procedure. If the procedure returns a value, you can store it with result <- procName(arg1, arg2, ...).

### What is the difference between RETURN and DISPLAY?

RETURN sends a value back to the point where the procedure was called. DISPLAY shows a value as output but does not give the procedure call a value to store or reuse.

### How should I trace procedure calls on the AP CSP exam?

Match arguments to parameters in order, run the procedure statements with those values, stop if you reach RETURN, and then continue from the line after the original call.

## Structured Data

```json
{"@context":"https://schema.org","@type":"FAQPage","inLanguage":"en","mainEntity":[{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#what-is-a-procedure-in-ap-computer-science-principles","name":"What is a procedure in AP Computer Science Principles?","acceptedAnswer":{"@type":"Answer","text":"A procedure is a named group of programming instructions that may take parameters and may return a value. Other programming languages may call the same idea a function or method."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#what-is-the-difference-between-parameters-and-arguments","name":"What is the difference between parameters and arguments?","acceptedAnswer":{"@type":"Answer","text":"Parameters are the input variables listed in a procedure definition. Arguments are the actual values passed into the procedure when it is called, and they match parameters by position."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#what-happens-when-a-procedure-is-called","name":"What happens when a procedure is called?","acceptedAnswer":{"@type":"Answer","text":"A procedure call pauses the normal sequence of statements, runs the statements inside the procedure, and then returns control to the line immediately after the call."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#how-do-you-call-a-procedure-in-ap-pseudocode","name":"How do you call a procedure in AP pseudocode?","acceptedAnswer":{"@type":"Answer","text":"The AP reference sheet uses procName(arg1, arg2, ...) to call a procedure. If the procedure returns a value, you can store it with result <- procName(arg1, arg2, ...)."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#what-is-the-difference-between-return-and-display","name":"What is the difference between RETURN and DISPLAY?","acceptedAnswer":{"@type":"Answer","text":"RETURN sends a value back to the point where the procedure was called. DISPLAY shows a value as output but does not give the procedure call a value to store or reuse."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu#how-should-i-trace-procedure-calls-on-the-ap-csp-exam","name":"How should I trace procedure calls on the AP CSP exam?","acceptedAnswer":{"@type":"Answer","text":"Match arguments to parameters in order, run the procedure statements with those values, stop if you reach RETURN, and then continue from the line after the original call."}}]}
```
