# Code Block

Several lines of code grouped to work together.

## What is a **Code Block**?

A **Block** of code is 1 or more lines of code 
grouped together as a logical unit. The gode is 
grouped because it logically belongs together and 
should be executed at the same time.

Some languages use {} to create a block - i.e. 
JavaScript, Java, C#
```Java
//Java
public int add(int left, int right) {
    // everything between {} is a block
    return left + right;
}
```

```Csharp
//C#
public int Add(int left, int right) 
{
    return left + right;
}
```

```JavaScript
//JavaScript
function add(left, right) {
    return left + right;
}
```

Some languages use indentation to create blocks - such as Python
```Python
def add(left, right):
    # everything indented is a block
    return left + right
```

Level: Novice · [More General terms at this level](https://www.ask-codey.com/glossary/subjects/general/novice)

Updated: October 16, 2026

Source: https://www.ask-codey.com/glossary/code-block
