# What does this 'do' syntax mean?

**URL:** <https://discourse.julialang.org/t/what-does-this-do-syntax-mean/25041>\
**Category:** New to Julia\
**Created:** [June 7, 2019, 11:13am UTC](https://discourse.julialang.org/t/what-does-this-do-syntax-mean/25041 "2019-06-07T11:13:48Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zgornel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zgornel/32/217487_2.png) [@zgornel](https://discourse.julialang.org/u/zgornel)\
**Post date:** [June 7, 2019, 2:33pm UTC](https://discourse.julialang.org/t/what-does-this-do-syntax-mean/25041/3 "2019-06-07T14:33:23Z")

</div>

Here is a trivial example:

```julia
my_function(f, container) = begin
    for element in container
        f(element)
    end
    return nothing
end

my_function([1,2,3]) do x # equivlent to my_function(print, [1,2,3])
    print(x)
end

```

Instead of specifying `(x)->print(x)` as an argument of `my_function`, with the `do` synatx one can write (generally larger) functions that operate on the rest of the arguments in the signature (in this case, the argument `container`)

---

_[View the full topic](https://discourse.julialang.org/t/what-does-this-do-syntax-mean/25041)._
