﻿---
title: csharp_new_line_before_else
description: Put else on its own line rather than joining it to the preceding brace. Defaults to `true`
url: https://docs-v3-preview.elastic.dev/reference/new-lines/csharp_new_line_before_else
---

# csharp_new_line_before_else
Put else on its own line rather than joining it to the preceding brace.

## Values


| Value   | Notes |
|---------|-------|
| `true`  |       |
| `false` |       |

**Default:** `true`

### `csharp_new_line_before_else = true`

```ini
csharp_new_line_before_else = true
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Classify(int n)
        {
            if (n > 0) {
                return "positive";
            } else if (n < 0) {
                return "negative";
            } else {
                return "zero";
            }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Classify(int n)
        {
            if (n > 0)
            {
                return "positive";
            }
            else if (n < 0)
            {
                return "negative";
            }
            else
            {
                return "zero";
            }
        }
    }
    ```
  </tab-item>
</tab-set>


### `csharp_new_line_before_else = false`

```ini
csharp_new_line_before_else = false
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Classify(int n)
        {
            if (n > 0)
            {
                return "positive";
            }
            else if (n < 0)
            {
                return "negative";
            }
            else
            {
                return "zero";
            }
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public string Classify(int n)
        {
            if (n > 0)
            {
                return "positive";
            } else if (n < 0)
            {
                return "negative";
            } else
            {
                return "zero";
            }
        }
    }
    ```
  </tab-item>
</tab-set>