# Function with initialized data

**URL:** <https://discourse.julialang.org/t/function-with-initialized-data/3908>\
**Category:** New to Julia\
**Created:** [May 24, 2017, 12:13pm UTC](https://discourse.julialang.org/t/function-with-initialized-data/3908 "2017-05-24T12:13:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [May 24, 2017, 12:21pm UTC](https://discourse.julialang.org/t/function-with-initialized-data/3908/2 "2017-05-24T12:21:08Z")

</div>

Don’t benchmark in global scope: put the variable definitions and the benchmarking code inside a function.

---

_[View the full topic](https://discourse.julialang.org/t/function-with-initialized-data/3908)._
