# A weird error when use two \`in\` in a for loop

**URL:** <https://discourse.julialang.org/t/a-weird-error-when-use-two-in-in-a-for-loop/29394>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 2, 2019, 7:39am UTC](https://discourse.julialang.org/t/a-weird-error-when-use-two-in-in-a-for-loop/29394 "2019-10-02T07:39:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon56330260](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon56330260](https://discourse.julialang.org/u/anon56330260)\
**Post date:** [October 2, 2019, 7:39am UTC](https://discourse.julialang.org/t/a-weird-error-when-use-two-in-in-a-for-loop/29394/1 "2019-10-02T07:39:09Z")

</div>

MWE:

```julia
function blur7!(in::Array{T,2},bv::Array{T,2}) where T
    m,n = size(in)
    bh = Array{T,2}(undef,32,2)
    for tx in in 1:32:m #here are two `in`s
        bh[i+1,1] = in[tx,1]
    end
end
m = 5
n = 5
A = collect(reshape(1.0:m*n,m,n))
B = Array{Float64}(undef,m-2,n-2)
blur7!(A,B)

```

Here I make a mistake, I mistype an additional `in`, however it doesn’t cause a syntax error, instead:

```julia
ERROR: ArgumentError: invalid index: 1.0 of
type Float64

```

It takes me some time to fix this type unstable problem, This is weird.Version info:

```julia
julia> versioninfo()
Julia Version 1.2.0-rc1.0
Commit 7097799cf1 (2019-05-30 02:22 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:

```

Any idea?

---

<div class="post-metadata">

**Author:** ![kdyrhage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdyrhage/32/2326_2.png) [@kdyrhage](https://discourse.julialang.org/u/kdyrhage)\
**Post date:** [October 2, 2019, 7:57am UTC](https://discourse.julialang.org/t/a-weird-error-when-use-two-in-in-a-for-loop/29394/2 "2019-10-02T07:57:27Z")

</div>

It’s being parsed as

```julia
for tx in in
    1:32:m
    bh[i+1,1] = in[tx,1]
end

```

where the second `in` is your function argument. Since it is an `Array{Float64,2}`, `tx` will contain floats.

---

<div class="post-metadata">

**Author:** ![anon56330260](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon56330260](https://discourse.julialang.org/u/anon56330260)\
**Post date:** [October 2, 2019, 8:02am UTC](https://discourse.julialang.org/t/a-weird-error-when-use-two-in-in-a-for-loop/29394/3 "2019-10-02T08:02:38Z")

</div>

thanks, maybe I should not use keyword for argument names…
