# Test whether bounds checking is on?

**URL:** <https://discourse.julialang.org/t/test-whether-bounds-checking-is-on/10377>\
**Category:** General Usage\
**Created:** [April 16, 2018, 9:32pm UTC](https://discourse.julialang.org/t/test-whether-bounds-checking-is-on/10377 "2018-04-16T21:32:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [April 16, 2018, 9:32pm UTC](https://discourse.julialang.org/t/test-whether-bounds-checking-is-on/10377/1 "2018-04-16T21:32:01Z")

</div>

dear j experts—I want to put a variety of asserts into my code, sort of like “programming by contract.” the cases in which I care about checking them are exactly the cases in which I like bounds checking; and when I want to speed it up, I am happy not to do my asserts. so, is there a const I can test to see whether bounds checking is currently enabled?

regards, /iaw

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 16, 2018, 9:57pm UTC](https://discourse.julialang.org/t/test-whether-bounds-checking-is-on/10377/2 "2018-04-16T21:57:13Z")

</div>

IIUC you can use [`@boundscheck`](https://docs.julialang.org/en/latest/base/base/#Base.@boundscheck) for that.
