Just for fun, a slightly more advanced way to solve this problem in Julia is to define your own iterator:

```
struct SkipRepeated{I}
inner::I
end
# See https://docs.julialang.org/en/v1/base/collections/#lib-collections-iteration-1
function Base.iterate(x::SkipRepeated)
state = iterate(x.inner)
state === nothing && return nothing
(val, _) = state
(val, state)
end
function Base.iterate(x::SkipRepeated, state)
(previous, innerstate) = state
while true
state = iterate(x.inner, innerstate)
state === nothing && return nothing
(val, innerstate) = state
val != previous && return (val, state)
end
end
Base.IteratorSize(::Type{<:SkipRepeated}) = Base.SizeUnknown()
Base.IteratorEltype(::Type{SkipRepeated{I}}) where {I} = Base.IteratorEltype(I)
Base.eltype(x::SkipRepeated) = eltype(x.inner)
```

which you can use as follows:

```
julia> rb = [1 1 2 3 3 3 0] # also works for your original row vector
1×7 Array{Int64,2}:
1 1 2 3 3 3 0
julia> for x in SkipRepeated(rb)
# simply iterating over SkipRepeated(rb) doesn't allocate a new vector
@show x
end
x = 1
x = 2
x = 3
x = 0
julia> collect(SkipRepeated(rb))
4-element Array{Int64,1}:
1
2
3
0
```