Cannot declare constant it already has a value

I used this struct I created a lot of times, but now, out of nothing, my VSCode started presenting this:

Any idea of what is happening?

I can reproduce this easily:
image

you see the line at the beginning cow=1.
So my guess you already have defined Cow somewhere else. Didn’t you want to take a break? :wink: Or did you took your nap already?

2 Likes

I know… I’m sorry, but I can’t. The deadline for my graduation project is tomorrow and my Dissertation advisor asked me to do some modifications on it. :sweat:

Couldn´t find it yet. Now the warning is appearing in two other struct files (out of nothing too)!

1 Like

Use search of VSCode.

1 Like

If you changed the definition of those structs and didn’t restart julia, this would happen as well. You cannot redefine a struct within a given session; it’s considered const.

3 Likes

so you have been working on this Julia code for months now ?

1 Like

If you changed the definition of those structs and didn’t restart julia, this would happen as well. You cannot redefine a struct within a given session; it’s considered const.

It worked! Thank you!

so you have been working on this Julia code for months now ?

About one year. I already presented it a few times. But now I’m creating a code for generate new data for testing.

1 Like

Thanks! I had the same issue coming from the fact that I included twice the same file containing a structure definition.