The use of Semicolon & Dashes to a Software engineer

25 Nov 2024    

Improving your written communication is critical for all high impact contributors - as a management or individual contributor. Clarity in written form transcends beyond time and provides leverage at work.


Semicolons


The semicolon looks like a comma with a period above it, and this can be a good way to remember what it does. A semicolon creates more separation between thoughts than a comma does but less than a period does. Here are the two most common uses of the semicolon:


  1. To help separate items in a list when the list already contains comma.

Semicolon makes it easier to distincguish between the lists

I bought shiny, ripe apples; small, sweet, juicy grapes; and firm pears.


  1. To join 2 sentences

An independent clause is a group of words that can stand on its own (independently)—it is a complete sentence. Semicolons can be used between two independent clauses. The semicolon keeps the clauses somewhat separate, like a period would do, so we can easily tell which ideas belong to which clause. But it also suggests that there may be a close relationship between the two clauses—closer than you would expect if there were a period between them.


If you have 3 sentences, you can use it to join 2 of the sentences with an emphasis of their closer relationship between them - closer than the 3rd sentence.


Dashes


They are almost never needed but for its effects, you can consider.


  1. Set emphasis into the sentence

Two dashes can emphasize material in the middle of a sentence. Some style and grammar guides even permit you to write a complete sentence within the dashes.


Example: Everything I saw in my new neighborhood—from the graceful elm trees to the stately brick buildings—reminded me of my alma mater.


Example (complete sentence): The students—they were each over the age of eighteen—lined up in the streets to vote for the presidential candidates.


  1. Indicate a sentence introduction or conclusion

This can be placed at the start of end of a sentence.


Example: Books, paper, pencils—many students lacked even the simplest tools for learning in nineteenth-century America.


Example: To improve their health, Americans should critically examine the foods that they eat—fast food, fatty fried foods, junk food, and sugary snacks.


  1. Add in bonus phrases

Phrases that are not needed but additional could be indicated using comma. But if your additional phrase has comma, you can consider using dash to set it apart the same way you would use comma for this same intention.


Slightly confusing example with commas: Even the simplest tasks, washing, dressing, and going to work, were nearly impossible after I broke my leg.


Better example with dashes: Even the simplest tasks—washing, dressing, and going to work—were nearly impossible after I broke my leg.


  1. To break up a dialogue
    Like how realistic conversations could, this could indicate a break in the person’s sentence.

Example: “I—I don’t know what you’re talking about,” denied the politician.


——


TLDR


There are tools in place to help improve readibility. A good work is a readable, and does not create confusion. This applies to coding as well. Given readability, the reader has less confusions and understands the intent of the written work. You can understand the original intent of the author and henceforth make adjustments, fix bugs in the context of coding.


Readability in the realm of code can be executed differently but that emphasis on readability is critical for every good coder.



Additional items:


To check for colon:
Ask yourself a question: does the material preceding the colon stand on its own?


References: