swift-book
swift-book copied to clipboard
Edits to punctuation to conform to style guide
Fixing punctuation around code examples to conform to the style guide. Only punctuation has changed.
I rather like that code examples are introduced by colons; this seems the more intuitive usage for me as a reader. Can we conform the style guide to the actual usage instead?
Can we conform the style guide to the actual usage instead?
That's exactly why I posted over at the Swift Forums. It doesn't matter to me either way. I did notice, though, that newer additions to sections tended to conform more closely to the present style guide. So, either way, there's some cleanup to be done. I'm happy to go in either direction. I just need to know which one. :)
The following comments are from Susan (one of our editors), who reviewed this PR today.
The punctuation/wording, etc is fine, except for these few instances where colons are needed below:
The following example reports a compile-time error.
let i = 1
Should be:
The following example reports a compile-time error: (use a colon because the sentence both directly references and precedes the code snippet.)
let i = 1
And the others (changed here):
However, the alternative example below is valid:
let i = 1
The example below uses the initializer to try to convert a String into an Int:
let possibleNumber = "123"
Write an optional binding for an if statement as follows:
if let <#constantName#> = <#someOptional#> {
The following if statements are equivalent:
if let firstNumber = Int("4"), let secondNumber = Int("42"), firstNumber < secondNumber && secondNumber < 100 {
The rubric is: ONLY use colons when the sentence preceding the code snippet directly references that code; otherwise use a period.