# Is there a built-in function that converts Val{n} to n?

**URL:** <https://discourse.julialang.org/t/is-there-a-built-in-function-that-converts-val-n-to-n/137665>\
**Category:** New to Julia\
**Created:** [June 17, 2026, 1:28am UTC](https://discourse.julialang.org/t/is-there-a-built-in-function-that-converts-val-n-to-n/137665 "2026-06-17T01:28:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HMegh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hmegh/32/216684_2.png) [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Post date:** [June 17, 2026, 1:28am UTC](https://discourse.julialang.org/t/is-there-a-built-in-function-that-converts-val-n-to-n/137665/1 "2026-06-17T01:28:04Z")

</div>

I am wondering if there is a built-in function that converts `Val{n}` to `n`? I typically need to convert `Val`’s to integers to name my simulation results properly. Usually, I add this function to my scripts:

```julia-auto
value(::Val{n}) where n = n

```

I am wondering if there is an equivalent function in `Base`?

---

<div class="post-metadata">

**Author:** ![penelopeysm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/penelopeysm/32/213172_2.png) [@penelopeysm](https://discourse.julialang.org/u/penelopeysm)\
**Post date:** [June 17, 2026, 1:50am UTC](https://discourse.julialang.org/t/is-there-a-built-in-function-that-converts-val-n-to-n/137665/2 "2026-06-17T01:50:39Z")

</div>

Grepping the Julia codebase I found this:

> <https://github.com/JuliaLang/julia/blob/15346901f0039751c5488744f1f62de7d87510a8/base/sort.jl#L2210>

But we probably (well, certainly) aren’t meant to use it 😃
