Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Vectors with different out-of-bounds behavior

$
0
0

@leiteiro wrote:

Consider integer vectors, Ivect(n) = Vector{Int}(undef, n).

If you access a vector A = Ivect(n) with indices < 1 or > n,
a BoundsError is thrown.

How can you introduce an integer vector type that simply returns 0 in these cases?

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles