A code block is a group of related lines of code that are treated as a single unit. In many programming languages, code blocks are surrounded by curly braces {}.