Skip to main content

Call (returns)

The value that is returned when this specified procedure is called.

Call (returns) block

Description

The Call (returns) block calls a procedure that returns a value. This is a code block part of the Procedures drawer.

Usage

Calls a procedure that returns a value.

Syntax

Inputs in this block:

  • A created procedure that returns a numerical value from the dropdown menu

Example

In this model, a created procedure calculates the distance of the "Turtle" agent from the center of spaceland using the pythagorean theorem. Whenever the calculate distance button is pushed, the procedure 'Calculate Distance' is called and the distance from the center is displayed in a data box. Note that this shape of the call block is used to retrieve the returned information from the procedure.

Call (returns) example code

Notes

The Call (returns) block is used when you need to retrieve a value from a procedure. This differs from the regular Call block which executes a procedure without returning a value.

  • Call - Call a procedure without returning a value
  • Procedure - Define a new procedure
  • Return Early - Return a value from a procedure