EDDYMENS

Published a year ago

What Is An Offset In Programming?

Table of contents

Definition

An offset describes how much of any data you would like to skip in a list before you begin some form of processing.

Example

01: [ 02: 1 => 'Person 1', 03: 2 => 'Person 2', 04: 3 => 'Person 3', 05: 4 => 'Person 4', 06: 5 => 'Person 5', 07: 6 => 'Person 6', 08: 7 => 'Person 7', 09: 8 => 'Person 8', 10: 9 => 'Person 9', 11: ]

Take the list shown above, the statement "Offset by 3 and fetch a size of 2" will mean we will skip the first three records and fetch two items after that. This gives us items 4 'Person 4' and 5 'Person 5'.

Summary

Offsets are commonly used in pagination [→] to skip over to interested pages.

Here is another article you might like 😊 What Is A DNS Server?