Skip to main content

OutOfRangeError

Error thrown when an operation attempts to access an element outside the valid range of a container or data structure.

OutOfRangeError is thrown by operations like array indexing, string character access, or container element retrieval (e.g. the [] operator) when the specified index or position is beyond the valid bounds. This helps prevent buffer overflows and undefined behavior.