# Using a Code Cell

{% hint style="success" %}
*Check out the given walk-through on how to use a Code Cell under a Notebook.*
{% endhint %}

![Using a code cell under a Notebook](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FrnZOSBpahXM06dMOfJJ7%2Fusing_a_code_cell.gif?alt=media\&token=1efb2485-294b-4866-9dd2-3eb383cbe85c)

You can write and execute code using the Notebook interface. This section covers the steps to write and run a sample code in the Code cell of the BDB DSL Notebook.

* Navigate to a Notebook.
* A cell to write and execute code opens under the selected Notebook.

![By default a Code gets added to a new Notebook ](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2Fyhhxce86SoSmS4Qwylze%2Fimage.png?alt=media\&token=ac2048a4-7d54-4566-9864-3b84cf2e5d48)

* Write code inside the cell.
* Click the ***Run cell*** icon to run the code.

![Write the code and run it](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2Fhn8a6T7oyV8s8EDDB0bp%2Fimage.png?alt=media\&token=69c72be5-6987-429c-a2a1-388d94963ca5)

* The Run cell button gets changed into the Interrupt cell icon while running the code.
* Another code cell gets added below (as shown in the following image).&#x20;

![While running the first cell one more cell gets added ](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FiGYtNVvYKDjr1w7vweDH%2Fimage.png?alt=media\&token=7e52506d-c7e5-4456-8c9e-6e9b50e07f2f)

* Once the code is run successfully a checkmark appears below the Run cell icon.
* The number before a cell indicates the count of the input executions for the notebook.

![When code gets run successfully](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2F6YA1FM4L8u3H7PUT02HJ%2Fimage.png?alt=media\&token=c9e298a9-79fa-423e-8a89-9b86acb58647)

* Click the Save icon provided for the Notebook.
* The Notebook gets saved with the new update.
* A notification message appears to indicate the completion of the action.         &#x20;

![Saving the Notebook](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FOFHkkeA9QDREyY571BWX%2Fimage.png?alt=media\&token=68eb9913-c37e-41b5-ba0b-c6edbfdf855a)

{% hint style="info" %} <mark style="color:green;">Please Note:</mark>&#x20;

* *The **+Code** and **+Markdown** options provided at the bottom of a cell inserts a new cell after the given code/ Markdown cell.* &#x20;

&#x20;      ![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FJYQHL0sSd25Su5d2jt5z%2Fimage.png?alt=media\&token=dfd948bd-88f9-4c38-ae4f-9245183a4d05)   &#x20;

* *While the **Code** and **Markdown** options provided under the **Code** section of the Task Bar adds a new cell before the given code/Markdown cell.*

{% endhint %}
