# Meaning of Base function source code in julia documentation

**URL:** <https://discourse.julialang.org/t/meaning-of-base-function-source-code-in-julia-documentation/88923>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 18, 2022, 6:12pm UTC](https://discourse.julialang.org/t/meaning-of-base-function-source-code-in-julia-documentation/88923 "2022-10-18T18:12:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Brunbjerg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christian_brunbjerg/32/34243_2.png) [@Christian\_Brunbjerg](https://discourse.julialang.org/u/Christian_Brunbjerg)\
**Post date:** [October 18, 2022, 6:12pm UTC](https://discourse.julialang.org/t/meaning-of-base-function-source-code-in-julia-documentation/88923/1 "2022-10-18T18:12:55Z")

</div>

Hello community!

I have been looking at source code for some functions and when looking at certain base functions (like shown in the picture) the function is simply defined as itself. How does this make sense? Where is the code that actually perfroms the function?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/4/a4f2f24a726a568b5f10571d7c3916ff317ea2be.png)

Best regards

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 18, 2022, 6:42pm UTC](https://discourse.julialang.org/t/meaning-of-base-function-source-code-in-julia-documentation/88923/2 "2022-10-18T18:42:42Z")

</div>

The implementation of iterate depends on the type you provide when calling, e.g.:

```julia
julia> s="12345"

julia> @less iterate(s)

@inline function iterate(s::String, i::Int=firstindex(s))
    (i % UInt) - 1 < ncodeunits(s) || return nothing
    b = @inbounds codeunit(s, i)
    u = UInt32(b) << 24
    between(b, 0x80, 0xf7) || return reinterpret(Char, u), i+1
    return iterate_continued(s, i, u)
end

```

What you have screenshoted is a function definition with 0 method. It’s like a stub, to provide the anchor for the help text shown when doing `?iterate`.

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [October 18, 2022, 6:45pm UTC](https://discourse.julialang.org/t/meaning-of-base-function-source-code-in-julia-documentation/88923/3 "2022-10-18T18:45:37Z")

</div>

Hi!

That’s a function declaration without an associated method definition i.e. it introduces the _name_ of the function to Julia without defining specific behaviour for a specific set of arguments. It’s useful to

1. organize documentation for the function separately where it doesn’t get in the way of the code, since any docstring placed above the declaration also becomes part of its documentation. This is a common practice especially in packages, where long explanatory docstrings can easily get in the way of navigating the code without this.
2. bring the name into scope so that other code in that scope can refer to `iterate` without needing to define a specific method for it.

The code that performs iteration for `Array`s is in array.jl. You can access it with `@edit iterate([1], 2)`.  
There are in total 200+ methods for `iterate` define in base Julia and standard libraries, you can access the others in a similar way too, eg. ` @edit iterate(1:10, 2)`, `@edit iterate("Hello Julia", 2)`, etc.
