# Scope of variable

**URL:** <https://discourse.julialang.org/t/scope-of-variable/43396>\
**Category:** General Usage\
**Created:** [July 20, 2020, 7:04pm UTC](https://discourse.julialang.org/t/scope-of-variable/43396 "2020-07-20T19:04:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [July 20, 2020, 7:35pm UTC](https://discourse.julialang.org/t/scope-of-variable/43396/6 "2020-07-20T19:35:07Z")

</div>

> [@pdeffebach](#):
>
> you have to put `global npoints` somewhere

When I use:

```julia
  global npoints = 10

```

I get the same error.

> [@pdeffebach](#):
>
> But why not just keep the `let` block?

That is what I started with, but then I run into benchmarking issues: [Unintuitive behaviour with BenchmarkTools](https://discourse.julialang.org/t/unintuitive-behaviour-with-benchmarktools/43291)

**EDIT**

I misunderstood your suggestion. Putting `global npoints` inside the `do` block solves the problem.

---

_[View the full topic](https://discourse.julialang.org/t/scope-of-variable/43396)._
