> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AL0003 - Don't divide by constant zero

> Integers and Decimal should never be divided by the constant 0

Source: [AL0003DontDivideByConstantZeroAnalyzer.cs](https://github.com/ANcpLua/ANcpLua.Analyzers/blob/main/src/ANcpLua.Analyzers/Analyzers/AL0003DontDivideByConstantZeroAnalyzer.cs)

## Description

Integers and Decimal should never be divided by the constant 0 as this causes a DivideByZeroException at runtime.

## Bad Code

```csharp theme={null}
int result = value / 0;
```

## Good Code

```csharp theme={null}
int result = divisor != 0 ? value / divisor : 0;
```

## Properties

* **Category**: Reliability
* **Severity**: Error
* **Enabled by default**: True
* **Code fix available**: False

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0003.severity = warning
```
