# Construct NamedTuple dynamically

**URL:** <https://discourse.julialang.org/t/construct-namedtuple-dynamically/15394>\
**Category:** General Usage\
**Tags:** namedtuple\
**Created:** [September 23, 2018, 6:26pm UTC](https://discourse.julialang.org/t/construct-namedtuple-dynamically/15394 "2018-09-23T18:26:45Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [February 27, 2020, 2:00pm UTC](https://discourse.julialang.org/t/construct-namedtuple-dynamically/15394/8 "2020-02-27T14:00:10Z")

</div>

Sorry for necroing but I see people still liking my post ([Construct NamedTuple dynamically - #2 by kristoffer.carlsson](https://discourse.julialang.org/t/construct-namedtuple-dynamically/15394/2)). It is likely better to use:

```julia
julia> mynames = (:a, :b, :c);

julia> myvalues = [1, 2.0, "hello world"];

julia> (;zip(mynames, myvalues)...)
(a = 1, b = 2.0, c = "hello world")

```

---

_[View the full topic](https://discourse.julialang.org/t/construct-namedtuple-dynamically/15394)._
