Julia is returning the value of `println("foo..")` from the function 
`foo()`; the value of the block expression is the value of the last 
expression in the block. It's turtles all the way down, so `println()` also 
returns a value in the same way, etc.

The error is because to destructure the return value into `a` and `b`, 
Julia iterates the return value. The return value of `foo`, which is the 
same as the return value from `println`, is something which is not iterable.

I agree that the error message isn't very helpful, but it's also hard to 
say how one would fix that.

On Monday, July 20, 2015 at 2:09:00 PM UTC-5, Kaj Wiik wrote:
>
> I started to get a strange error while debugging my code, here's a 
> simplified example:
>
> julia> function foo(a)
>            println("foo..")
>        end
> foo (generic function with 1 method)
>
> julia> a = foo(2)
> foo..
>
> julia> a,b = foo(2)
> foo..
> ERROR: `start` has no method matching start(::Nothing)
>
>
> So, the problem was a missing return value, it is strange that missing one 
> value did not give error but two values.... It took a quite long time to 
> track this down. Perhaps a bit more informative error message would be 
> possible...?
>
> Cheers,
> Kaj
>
>

Reply via email to