My goal is to replace any elements in array A that are either NaN or <0 with the corresponding elements in Array B.

Below is my code:

```
A = [1, 2.1, -5, 6, -3, 8, NaN];
B = [8, 8.2, 8, 8, 8, 8, 8];
C = replace!(x -> (x<0 || isnan(x)) ? B : x, A)
```

Here is the error:

```
MethodError: Cannot `convert` an object of type Vector{Float64} to an object of type Float64
Closest candidates are:
convert(::Type{T}, ::T) where T<:Number at number.jl:6
convert(::Type{T}, ::Number) where T<:Number at number.jl:7
convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250
...
```

Why isn’t it working? Many thanks!