Code cells contain executable code. The default language that you use in code cells is Python. However, you can choose Kotlin when creating a notebook.
First code cell
By default, the empty code cell is where you start coding in your new notebook. Your cursor is already placed inside this cell.
Write your code.
Click the Run icon on the toolbar to have the code executed. The result of the computation (output) will be displayed in the same cell right under the input.
Add a code cell
You have a few ways to insert a code cell:
- Click the Add code cell button.
Click the + icon on the selected cell to insert a code cell below.
Press Ctrl + Alt + Enter to insert a code cell above the selected one.
Click the ellipsis on the cell toolbar or right-click anywhere in the editor field to select either action from the cell menu.
Now that you have more than one cell in your notebook, you can reorder them:
Press Ctrl + Shift + ↑ or Ctrl + Shift + ↓ to move the selected cell one cell up or one cell down.
Right-click the cell and try the same actions from the cell menu.
Code cell output and view
You can have different kinds of code cell output, including text, tables, graphics, and so on. By default, the layout of a code cell displays both its code and output placed vertically. You can change how they are displayed. Go toand try different options.