# Code Block

*noun*

say it: **“KOHD blok”** **/koʊd blɒk/**

Several lines of code grouped together so they run as one unit. In JavaScript a block sits between curly braces, { and }.

## 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
```

## In a sentence

- “Everything inside the curly braces is one **code block**, so all three lines run when the order qualifies.”

Level: Novice · [More General terms at this level](https://www.ask-codey.com/glossary?category=general&level=1)

Updated: November 9, 2026

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