Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should we insert blank line(s) in source code?

I'm not sure where I should add new blank line(s) in my source code. I would like to write beautiful code that is both easy to read and understand.

Is it object-based only, or concept-based? Answers with examples would be most helpful to me.

like image 979
Faulty Orc Avatar asked Apr 14 '11 09:04

Faulty Orc


People also ask

How do you insert a blank line in code?

To add a line break to your HTML code, you use the <br> tag. The <br> tag does not have an end tag. You can also add additional lines between paragraphs by using the <br> tags. Each <br> tag you enter creates another blank line.

Is used to insert blank lines in HTML?

The <br> tag inserts a single line break. The <br> tag is useful for writing addresses or poems. The <br> tag is an empty tag which means that it has no end tag.

Should I leave empty lines in HTML?

Yes as long as it improve readability, I usually insert blank line for very big segments like 50+ rows. Often where php or javascript is inserted. Machines doesnt care if there are blank rows but SEO optimalization might.

What element is used to insert blank lines?

Tip #1: Use <br> tags to create line breaks in text, instead of using multiple paragraphs or other elements. This can be simpler and easier to maintain. Tip #3: Use <br> tags to create extra space between elements on a page. That's right – you can just brute-force inserting empty vertical space by typing <br><br><br> .


1 Answers

I think it's a matter of personal preference or maybe of company standard, but here in the office, even if we have some guidelines, everyone has his way of writing code, and whitespace is one of the differences.

I prefer to use a lot of blank lines. Every time the context of my code changes I separate this part from the previous and next, and comment the whole block before.

like image 102
Alessandro Avatar answered Nov 03 '22 15:11

Alessandro