There are differences between single quotation marks and double quotation marks, how to style them, and where to place punctuation that is used near a quotation mark.
Use logical quotation
When you place a keyword or other string literal within quotation marks, put punctuation, like commas and periods, outside of the final quotation mark.
-
- Correct
- If you see the message “Authentication Failed”, try logging in again.
- The message shows “Authentication Successful”.
-
- Incorrect
- If you see the message “Authentication Failed,” try logging in again.
- The message shows “Authentication Successful.”
Use straight quotation marks
Use straight quotation marks instead of curly quotation marks when you write. In certain scenarios, especially in code examples, you must use straight quotation marks because curly quotation marks cause code to break. A better practice is to use straight quotes everywhere in your writing.
When to use single quotation marks
Use single quotation marks for code examples in languages that use the mark. See the following example:
DRUCARE_HOME = os.environ['DRUCARE_HOME']<br><br> LOGGING_DEFAULT_CONFIG_FILE = os.path.join(DRUCARE_HOME, 'etc', 'log.cfg')
When to use double quotation marks
Use double quotation marks to format the following elements:
-
To offset words that aren’t part of the meaning of your sentence
-
Error messages
Don’t use quotation marks for emphasis, to show user input, or to enclose the names of UI elements.
-
- Correct
- Search for “Query tables” on the Microsoft website.
- If you see an error message that says “The user isn’t authenticated”, check the user’s permissions.
-
- Incorrect
- Enter “Filename” into the UI field.
- From the “Field” menu, select Filename.
For a full list of formatting rules for commonly documented elements, including the elements that take quotation marks, see Formatting reference.