---
title: "What are Code Blocks in Views?"  
description: "What are Code Blocks in Views?"  
author: "Manish Kumar"  
published: 2017-05-15  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/23246/what-are-code-blocks-in-views  
category: "c#"  
tags: ["mvc4"]  
reading_time: 1 minute  

---

# What are Code Blocks in Views?

Unlike code expressions that are evaluated and sent to the response, this is the blocks of code that are executed. It is useful for declaring variables that may be required to be used later.\

\

```
 @{ int x = 123; string y = "aa"; }
```

## Answers

### Answer by Manish Kumar

Unlike code expressions that are evaluated and sent to the response, this is the blocks of code that are executed. It is useful for declaring variables that may be required to be used later.\

\

```
 @{ int x = 123; string y = "aa"; }
```


---

Original Source: https://www.mindstick.com/interview/23246/what-are-code-blocks-in-views

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
