---
title: "single-case-switch"
description: "Replace a switch with one simple case by an if statement."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# single-case-switch

**Default severity:** `warning`

A switch with one non-default condition and no additional cases is more
directly expressed as an `if` statement.

## Bad

```go
switch value {
case 1:
	use(value)
}
```

## Good

```go
if value == 1 {
	use(value)
}
```

Source: https://strider.gempir.com/lints/single-case-switch/index.mdx
