Reference 〉 Function

Shocks.everyn(nint, offsetint0)

Generates a timer function that returns True periodically every so many periods.

Parameters

  • n int, required

    The length of the interval between True periods. For example, n=2 would return True on even periods.

  • offset int, optional

    Shifts the periodicity of the interval. For example, n=2 and offset=1 would return True on odd periods.

    Default value: 0

Return Value func(int)

A timer function that takes the model time and returns a boolean.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.