Writing & StyleStyle guide

Clearly Labeling Bad Code Examples

Clearly Labeling Bad Code Examples records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Quick answer

Clearly identify intentionally incorrect or bad code examples so readers do not mistake them for recommended patterns.

Key details

Core Issuelabeling intentionally bad code
RegisterMicrosoft Learn technical documentation

Important caveats

Scope Boundary

This is a documentation-safety convention for deliberately bad examples; it does not mean ordinary compiler errors or diagnostic messages need the same treatment.

Further guidance

Content

Clearly identify intentionally incorrect or bad code examples so readers do not mistake them for recommended patterns.

Purpose

Keep technical documentation readable, reusable, and unambiguous for readers while following current Microsoft Learn contributor conventions.

Sources and evidence

Sources are shown with the role they play in this guide. Historical or style-sensitive claims are kept within the evidence boundary described above.

  1. How to include code in docs — Microsoft Learn Contributor Guide (opens in a new tab)Microsoft · Current Microsoft Learn contributor guidance on including code in documentation, including link/code styling, code-block quality checks, screenshots, validation, highlighting, scrollability, bad-code labeling, and in-repository snippet references.

Related guides

Writing & Style

Avoiding IDE Screenshots for Code Examples

Avoiding IDE Screenshots for Code Examples records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Explore the topic