py::builtins::range::step

constexpr const long& step() const;

Returns the step value of the range.

The step value defines the difference between two values. This defines how much to add to a value to get the next one.

Note

The value of this variable is always a non-zero integer.

Return value

The step value of the range.

Complexity

Constant.

Example

#include <pypp/builtins/range.hpp>
#include <pypp/builtins/print.hpp>

int main()
{
    py::range<int> nums(10, 20, 2);
    py::print(nums.step()));
}

Output:

2