# Getting warning Cannot declare constant; it already has a value

**URL:** https://discourse.julialang.org/t/getting-warning-cannot-declare-constant-it-already-has-a-value/63480
**Category:** General Usage
**Tags:** question
**Created:** [June 24, 2021, 2:50am UTC](https://discourse.julialang.org/t/getting-warning-cannot-declare-constant-it-already-has-a-value/63480 "2021-06-24T02:50:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![james-garfield](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/james-garfield/32/26409_2.png) [@james-garfield](https://discourse.julialang.org/u/james-garfield)
#### Post date: [June 24, 2021, 2:50am UTC](https://discourse.julialang.org/t/getting-warning-cannot-declare-constant-it-already-has-a-value/63480/1 "2021-06-24T02:50:50Z")

</div>

I have a mutable struct that is giving me a warning `Cannot declare constant; it already has a value`. I do not declare const for any values in my struct constructor.

I’m still quite new to Julia so I’m not too understanding yet about the way it holds objects in memory and whatnot.

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [June 24, 2021, 5:16am UTC](https://discourse.julialang.org/t/getting-warning-cannot-declare-constant-it-already-has-a-value/63480/2 "2021-06-24T05:16:02Z")

</div>

`struct` definitions are constants, so redefining a struct with the same name leads to the warning.

This does not have anything to do with mutability or how julia objects are laid out in memory.

If you’re not yet sure how many fields your struct should have, consider experimenting with a [Named Tuple](https://docs.julialang.org/en/v1/base/base/#Core.NamedTuple) first, and transitioning to a struct later on (using accessor functions to get fields etc.) once performance becomes a concern.
