How to Comment Multiple Lines in a Databricks Notebook

Here’s how to comment out multiple lines in a Databricks notebook, depending on the type of code:

Python or Scala Code

  1. Highlight the lines you want to comment.
  2. Use these shortcuts:
    • Windows/Linux: Press Ctrl + /
    • Mac: Press Cmd + /

    This adds a # at the start of each selected line.

SQL Code

Uncommenting