You can use FillArrays.jl for this:
julia> using FillArrays
julia> x = Fill(false, 10)
10-element Fill{Bool}: entries equal to false
julia> x[3]
false
julia> x[11]
ERROR: BoundsError: attempt to access 10-element Fill{Bool} at index [11]
Stacktrace:
[1] throw_boundserror(A::Fill{Bool, 1, Tuple{Base.OneTo{Int64}}}, I::Tuple{Int64})
@ Base ./abstractarray.jl:645
[2] checkbounds
@ ./abstractarray.jl:610 [inlined]
[3] getindex(F::Fill{Bool, 1, Tuple{Base.OneTo{Int64}}}, kj::Int64)
@ FillArrays ~/.julia/packages/FillArrays/FPGoE/src/FillArrays.jl:41
[4] top-level scope
@ REPL[11]:1