Formatting the code is quite important to make it readable. It is recommended that you properly format the code regularly, and especially before sharing it with someone else.
Follow these steps to auto-format code in Arduino IDE −
Alternatively, you can press Ctrl+T on your keyboard. This will format the code and add the correct indentations wherever required.