# For loop giving "no method matching iterate" error

**URL:** <https://discourse.julialang.org/t/for-loop-giving-no-method-matching-iterate-error/24021>\
**Category:** New to Julia\
**Created:** [May 9, 2019, 10:44am UTC](https://discourse.julialang.org/t/for-loop-giving-no-method-matching-iterate-error/24021 "2019-05-09T10:44:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freestyler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freestyler/32/8388_2.png) [@Freestyler](https://discourse.julialang.org/u/Freestyler)\
**Post date:** [May 9, 2019, 10:44am UTC](https://discourse.julialang.org/t/for-loop-giving-no-method-matching-iterate-error/24021/1 "2019-05-09T10:44:43Z")

</div>

Hi,  
I have some scripts that I would like to debug (using Atom + Juno).

If my understanding of the Julia debugger mechanics is correct, I have to wrap the code in a function in order to be able to call it, so I wrapped the main script code in a function and I’m calling that function from the REPL with `Juno.@enter Main.mainFunction()`.

It seems that the debugger is working, more or less. I can do step-by-step debugging and see variables values. Unfortunately I’m still not able to place breakpoints, but I have to solve another problem before that…

I’m getting this weird error on a nested for loop that works correctly if the code isn’t wrapped:

```julia
    for req=1:numRequests
        log("blah")
        for report_root_node_id in nodeID_array
            log("yada")
        end
    end

```

and the error I get is:

```julia
ERROR: LoadError: MethodError: no method matching iterate(::Type{Array{String,1}})
Closest candidates are:
  iterate(::Core.SimpleVector) at essentials.jl:568
  iterate(::Core.SimpleVector, ::Any) at essentials.jl:568
  iterate(::ExponentialBackOff) at error.jl:199
  ...
Stacktrace:
 [1] mainFunction() at D:\Julia_Code\Main.jl:49
 [2] top-level scope at none:0
in expression starting at D:\Julia_Code\Main.jl:65

```

The outer for works flawlessly, but the inner one raises that strange error. Am I missing something?

Thanks!

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [May 9, 2019, 11:44am UTC](https://discourse.julialang.org/t/for-loop-giving-no-method-matching-iterate-error/24021/2 "2019-05-09T11:44:26Z")

</div>

You’ve probably done something like this:

```julia
nodeID_array = Vector{String}

```

when you meant to do

```julia
nodeID_array = Vector{String}()

```

The former makes `nodeID_array`’s value the type `Vector{String}` not an instance of that type, whereas the latter makes it an empty value of that type.
