Semicolons

Where to use semicolons is often a matter of judgment. Use them judiciously.

Between two independent clauses

Use a semicolon between two closely related independent clauses that are not quite unrelated enough to merit a period, but where a comma isn't quite enough.

Examples

Recommended: The Earth Engine image must have exactly one or three bands when exporting to GME; other images cause the export to fail.

Recommended: You can easily test compatibility by computing the centroid; if it is on the opposite side of the planet, reverse the order of your vertices.

Before a conjunctive adverb

A semicolon precedes a conjunctive adverb that joins two independent clauses. Conjunctive adverbs include the following: accordingly, also, besides, consequently, furthermore, hence, however, indeed, in fact, likewise, similarly, therefore, and thus. For a longer list of conjunctive adverbs, scroll to the bottom of the page at Ginger Software's Grammar Rules: Conjunctive Adverbs.

Examples

Recommended: The style of this button is up to you; however, you must still follow branding guidelines.

Recommended: This setup places the head-tracked node below the Main Camera; therefore, only the stereo cameras are affected by the user's head motion.

Before an independent clause

A semicolon may appear before an independent clause that is introduced by a phrase such as "that is," "for example," "namely," and so on.

Examples

Recommended: The next polling interval to use; that is, the number of seconds before the client should contact the server again.

Recommended: The URL from which a video ad loads; that is, the URL to use to fetch that video ad.

Between complex items in a series

When you have a series of long or complex items, such as items that themselves contain punctuation, use semicolons, rather than commas, as separators.

Examples

Recommended: If you don't have time, then focus on the improvements that will have the greatest benefit: what matters most to your users; what is most important to fix; and what is easy or feasible to fix in the available time.

Recommended: Review your document one more time, checking for the following: present tense and active voice; typos, punctuation, and grammar; and whether you can shorten anything.

Notice that in the final example, the second item in the list is itself a list.

发送以下问题的反馈:

此网页
Google Developer Documentation Style Guide
Google Developer Documentation Style Guide