Suppose I have p = [true, true, false, false] and q = [true, false, true, false]. How can I logically "and" them, say like
p .&& q?
Suppose I have p = [true, true, false, false] and q = [true, false, true, false]. How can I logically "and" them, say like
p .&& q?
Use .& instead:
julia> p=[true, true, false, false]
4-element Array{Bool,1}:
1
1
0
0
julia> q=[true, false, true, false]
4-element Array{Bool,1}:
1
0
1
0
julia> p .& q
4-element BitArray{1}:
1
0
0
0
You have to be careful though as & works also on non-Bool elements:
julia> [11,12,13] .& [3,2,1]
3-element Array{Int64,1}:
3
0
1