Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A How to structure a sentence containing long code examples?

In the context of a technical manual, I need to write instructions guiding users through several standard manipulations. When providing examples of these manipulations, I have written a short sente...

4 answers  ·  posted 9y ago by Dave Jones‭  ·  edited 4y ago by Monica Cellio‭

#4: Post edited by user avatar Monica Cellio‭ · 2020-07-10T01:04:45Z (over 4 years ago)
  • In the context of a technical manual, I need to write instructions guiding users through several standard manipulations. When providing examples of these manipulations, I have written a short sentence containing "before" and "after" examples which appear in (potentially multi-line) vertical blocks of their own. As a result, I am unsure as to whether the middle of the sentence should be capitalized. Additionally, a suggestion was made on ELU SE that removal of colons leading the code blocks may be preferable. I have presented an example of this below as well.
  • * * *
  • **With capitalization**
  • Hence, the following code:
  • camera.start_recording('foo.h264', quantization=25)
  • Should be replaced with:
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • **Without capitalization**
  • Hence, the following code:
  • camera.start_recording('foo.h264', quantization=25)
  • should be replaced with:
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • **Without capitalization or colons**
  • Hence, the following code
  • camera.start_recording('foo.h264', quantization=25)
  • should be replaced with
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • My instinct suggests the second or third examples are preferable, but I'd be interested to learn of any style rules addressing this. For that matter, if there is a better way of structuring such examples which avoids these issues altogether, I would be most interested!
  • [Should I capitalise "or" between examples?](https://english.stackexchange.com/questions/199088/should-i-capitalise-or-between-examples) was the most relevant question I could find to this one (and indeed was the corner of SE where I first posed this query, before being made aware of Writers), and I tend to agree with its reasoning that the lowercase version is preferable. Unfortunately the best suggestion in its answer (to use a bullet list of examples) doesn't really lend itself to potentially large blocks of code.
  • In the context of a technical manual, I need to write instructions guiding users through several standard manipulations. When providing examples of these manipulations, I have written a short sentence containing "before" and "after" examples which appear in (potentially multi-line) vertical blocks of their own. As a result, I am unsure as to whether the middle of the sentence should be capitalized. Additionally, a suggestion was made on ELU SE that removal of colons leading the code blocks may be preferable. I have presented an example of this below as well.
  • * * *
  • **With capitalization**
  • Hence, the following code:
  • camera.start_recording('foo.h264', quantization=25)
  • Should be replaced with:
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • **Without capitalization**
  • Hence, the following code:
  • camera.start_recording('foo.h264', quantization=25)
  • should be replaced with:
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • **Without capitalization or colons**
  • Hence, the following code
  • camera.start_recording('foo.h264', quantization=25)
  • should be replaced with
  • camera.start_recording('foo.h264', quality=25)
  • * * *
  • My instinct suggests the second or third examples are preferable, but I'd be interested to learn of any style rules addressing this. For that matter, if there is a better way of structuring such examples which avoids these issues altogether, I would be most interested!
  • [Should I capitalise "or" between examples?](https://english.stackexchange.com/questions/199088/should-i-capitalise-or-between-examples) was the most relevant question I could find to this one (and indeed was the corner of SE where I first posed this query, before being made aware of Writers), and I tend to agree with its reasoning that the lowercase version is preferable. Unfortunately the best suggestion in its answer (to use a bullet list of examples) doesn't really lend itself to potentially large blocks of code.
#3: Attribution notice added by user avatar System‭ · 2019-12-08T04:06:36Z (almost 5 years ago)
Source: https://writers.stackexchange.com/q/16512
License name: CC BY-SA 3.0
License URL: https://creativecommons.org/licenses/by-sa/3.0/
#2: Initial revision by user avatar Dave Jones‭ · 2019-12-08T04:06:36Z (almost 5 years ago)
In the context of a technical manual, I need to write instructions guiding users through several standard manipulations. When providing examples of these manipulations, I have written a short sentence containing "before" and "after" examples which appear in (potentially multi-line) vertical blocks of their own. As a result, I am unsure as to whether the middle of the sentence should be capitalized. Additionally, a suggestion was made on ELU SE that removal of colons leading the code blocks may be preferable. I have presented an example of this below as well.

* * *

**With capitalization**

Hence, the following code:

    camera.start_recording('foo.h264', quantization=25)

Should be replaced with:

    camera.start_recording('foo.h264', quality=25)

* * *

**Without capitalization**

Hence, the following code:

    camera.start_recording('foo.h264', quantization=25)

should be replaced with:

    camera.start_recording('foo.h264', quality=25)

* * *

**Without capitalization or colons**

Hence, the following code

    camera.start_recording('foo.h264', quantization=25)

should be replaced with

    camera.start_recording('foo.h264', quality=25)

* * *

My instinct suggests the second or third examples are preferable, but I'd be interested to learn of any style rules addressing this. For that matter, if there is a better way of structuring such examples which avoids these issues altogether, I would be most interested!

[Should I capitalise "or" between examples?](https://english.stackexchange.com/questions/199088/should-i-capitalise-or-between-examples) was the most relevant question I could find to this one (and indeed was the corner of SE where I first posed this query, before being made aware of Writers), and I tend to agree with its reasoning that the lowercase version is preferable. Unfortunately the best suggestion in its answer (to use a bullet list of examples) doesn't really lend itself to potentially large blocks of code.

#1: Imported from external source by user avatar System‭ · 2015-03-17T19:13:53Z (over 9 years ago)
Original score: 2