# M0004 declared and not used (/docs/diagnostics/codes/m0004)

<Diagnostic code="M0004" />

Assigning to a variable does not count as a use.

## The mistake and the fix [#the-mistake-and-the-fix]

<div className="code-pair">

```go title="The mistake"
count := len(xs) // never read
```

```go title="Fixed"
// remove it, or use it: // [!code highlight]
count := len(xs) // [!code highlight]
fmt.Println(count) // [!code highlight]
```

</div>

## The fix [#the-fix]

Use the variable, remove it, or assign the value to _.

See also [all error codes](/docs/diagnostics/codes) and [marmot explain](/docs/commands/explain).