Back to English for Coders
IntermediateTeenagers
Active vs. Passive Voice
The 'voice' of a sentence describes whether the subject performs or receives the action of the verb. This is crucial for clear technical writing.
**Active Voice:** The subject performs the action. This is direct, clear, and generally preferred.
- Example: "The compiler **threw** an error."
- Subject: "The compiler"
- Action: "threw"
**Passive Voice:** The subject receives the action. This can be wordy or ambiguous.
- Example: "An error **was thrown** by the compiler."
- Subject: "An error"
- Action: "was thrown"
Notice how the active voice is more direct. It immediately tells you *who* or *what* did the action. In code comments, git commits, and documentation, active voice makes responsibility and action clear.
- **Prefer:** "The function validates the input."
- **Avoid:** "The input is validated by the function."
Use passive voice sparingly, perhaps when the actor is unknown or unimportant.
**Active Voice:** The subject performs the action. This is direct, clear, and generally preferred.
- Example: "The compiler **threw** an error."
- Subject: "The compiler"
- Action: "threw"
**Passive Voice:** The subject receives the action. This can be wordy or ambiguous.
- Example: "An error **was thrown** by the compiler."
- Subject: "An error"
- Action: "was thrown"
Notice how the active voice is more direct. It immediately tells you *who* or *what* did the action. In code comments, git commits, and documentation, active voice makes responsibility and action clear.
- **Prefer:** "The function validates the input."
- **Avoid:** "The input is validated by the function."
Use passive voice sparingly, perhaps when the actor is unknown or unimportant.
Rewrite in Active Voice
The variable `passive_sentence` contains a sentence in the passive voice. Rewrite it in the active voice and assign it to the `active_sentence` variable.