# CodeSOD: Doing the Assignment

DevFeed: [CodeSOD: Doing the Assignment](<https://devfeed.tech/articles/codesod-doing-the-assignment-92580.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/doing-the-assignment>)

Author: Remy Porter

Published: 2026-10-21T06:30:00Z

Content type: article

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [Variable](<https://devfeed.tech/topics/variable.md>)

Tags: [codesod](<https://devfeed.tech/tags/codesod.md>)

## AI overview

The code initializes `x`, `y`, and `z` separately, then chains `x = y = z`, so `x`'s initial value of 3 is overwritten with 4. The excerpt questions why the variables are initialized this way and suggests either assigning 4 to all three in one chain or using a named constant such as `DEFAULT_VALUE` for clarity.

## Source excerpt

Today's code maybe isn't much of a WTF, but it does point in the general direction of, "Damn, you live like this?" Poor Nancy unfortunately does. int x = 3; int y = 4; int z = 4; x = y = z; Each variable is declared and initialized, and then they're set equal to each other. It just raises the question though, why do it this way? Why not declare them and then x = y = z = 4, if we want that? Or maybe, for more clarity, int x = DEFAULT_VALUE; would be more legible, and we can skip the multiple assignments on one line. Why does x get set to 3 but then overwritten? [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.