melanzane
melanzane

Reputation: 523

Compare values of two arrays in julia

I have two integer arrays that I need to compare. The output of the comparison of sequenceOne = [1, 3, 2, 1] and sequenceTwo = [1, 3, 2, 1] should be true. Is there a method for that?

Upvotes: 2

Views: 8336

Answers (1)

fredrikekre
fredrikekre

Reputation: 10984

Just use ==:

julia> sequenceOne = [1, 3, 2, 1];

julia> sequenceTwo = [1, 3, 2, 1];

julia> sequenceOne == sequenceTwo
true

Alternatively, if you are looking to compare elementwise then you can broadcast == with a .

julia> sequenceOne .== sequenceTwo
4-element BitArray{1}:
 true
 true
 true
 true

Upvotes: 5

Related Questions