In programming, there are as many ways to destroy something as to create something. One stray character is all that’s required. Say you forget a semicolon or use an accented “é” somewhere, but the code is not prepared for such a peculiarity—KABOOM! Or you add two things together, but one is the numeral 4 and the other is “4” as a string, as you might use to say “4 and 20 blackbirds baked in a pie.” To the computer, that “4 and 20” has no numeric significance.
THEN:
This sort of thing really happens, and part of the job is remembering that 4 + 20 is 24 and 4 + “20” is “420”.
SHOULD BE:
This sort of thing really happens, and part of the job is remembering that 4 + 20 is 24 and "4" + “20” is “420”.
[Said simply]
To denote string rather than numeral, the proper character is "4" not 4.
Thank you,
Tia Dobi
P.S. I'm new to GitBit and couldn't figure out how to add this as a Pull request.
P.P.S. One could also say that "4 and 20 blackbirds" denotes 24 blackbirds because here, the word "and" is synonymous with addition. Or, one might consider creating a coder "Proofreading" markup language to close the gap between 4 [and] 20 which would be changed from: 4 20 to 420.
Actually, 4 with no quotation marks might be fine- if you try programming 4+"20" in say a JavaScript console, the console evaluates it to "420", so I think that the article is fine on this. Check this out:
For your consideration . . . .
Given the syntax under:
6.2 What Is Debugging?
IF:
In programming, there are as many ways to destroy something as to create something. One stray character is all that’s required. Say you forget a semicolon or use an accented “é” somewhere, but the code is not prepared for such a peculiarity—KABOOM! Or you add two things together, but one is the numeral 4 and the other is “4” as a string, as you might use to say “4 and 20 blackbirds baked in a pie.” To the computer, that “4 and 20” has no numeric significance.
THEN: This sort of thing really happens, and part of the job is remembering that 4 + 20 is 24 and 4 + “20” is “420”.
SHOULD BE:
This sort of thing really happens, and part of the job is remembering that 4 + 20 is 24 and "4" + “20” is “420”.
[Said simply]
To denote string rather than numeral, the proper character is "4" not 4.
Thank you, Tia Dobi
P.S. I'm new to GitBit and couldn't figure out how to add this as a Pull request. P.P.S. One could also say that "4 and 20 blackbirds" denotes 24 blackbirds because here, the word "and" is synonymous with addition. Or, one might consider creating a coder "Proofreading" markup language to close the gap between 4 [and] 20 which would be changed from: 4 20 to 420.