BoundsError

BoundsError([a],[i])

An indexing operation into an array, a, tried to access an out-of-bounds element, i.

Examples

In the Julia programming language, the BoundsError([a], [i]) function is raised when an indexing operation attempts to access an out-of-bounds element i in the array a. The error indicates that the index provided is not within the valid range of the array.

Example:

julia> arr = [1, 2, 3];
julia> arr[4]
ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [4]

In this example, the index 4 is out of bounds for the array arr, which only has elements at indices [1, 2, 3]. The BoundsError is raised to indicate the invalid access.

It's important to ensure that the indices used for array indexing are within the valid range to avoid BoundsError exceptions.

See Also

ArgumentError, AssertionError, BoundsError, DivideError, DomainError, EOFError, error, ErrorException, InexactError, InitError, KeyError, LoadError, MethodError, OutOfMemoryError, OverflowError, ParseError, ReadOnlyMemoryError, showerror, StackOverflowError, SystemError, TypeError, UndefRefError, UndefVarError,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: