Editing 2309: X

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 17: Line 17:
 
A {{w|Variable (computer science)|variable}} is a piece of data (such as an integer or a string of text) whose value can change over the run of a program. Variables are identified by name and can usually be named any string of alphanumeric characters. To make code easier for a human to follow, variables are usually given a name that indicates what the variable is for; for example, a variable counting how many seconds have passed since the program was launched might be called '''elapsedTime'''.
 
A {{w|Variable (computer science)|variable}} is a piece of data (such as an integer or a string of text) whose value can change over the run of a program. Variables are identified by name and can usually be named any string of alphanumeric characters. To make code easier for a human to follow, variables are usually given a name that indicates what the variable is for; for example, a variable counting how many seconds have passed since the program was launched might be called '''elapsedTime'''.
  
βˆ’
The {{w|Variable (mathematics)|overall concept of a variable}} is usually first taught in {{w|Algebra}}, where the most basic nondescript name for a variable is '''x'''. When first learning or teaching programming, it's not unheard of for sample variables in practice problems to be named "x". However, outside of a controlled learning environment calling any variable "x" is considered bad coding practice, because anyone reading the code will not immediately understand what the variable does unless they are familiar with it. Even the original programmer may come back to it and find that they have forgotten what the variable was for.
+
Some programmers, particularly if they are working under time pressure, may give their variables nondescript names such as '''x'''. This is considered bad coding practice, because anyone reading the code will not immediately understand what the variable does unless they are familiar with it. Even the original programmer may come back to it and find that they have forgotten what the variable was for.
  
 
Here, Cueball is developing a language where ''all'' variables are named '''X''' - and the only way to differentiate different Xs is to write it in different typefaces. Needless to say, this is a terrible idea. The language would be a nightmare to program in, as all of the variables would look very similar unless careful attention is being paid, and there would be little to no way to determine what each one does, since font names are typically not very descriptive. Additionally, the fact that some fonts look similar (such as Arial and Helvetica) would require the programmer to have an intricate knowledge of different fonts and how to distinguish them from only one letter.
 
Here, Cueball is developing a language where ''all'' variables are named '''X''' - and the only way to differentiate different Xs is to write it in different typefaces. Needless to say, this is a terrible idea. The language would be a nightmare to program in, as all of the variables would look very similar unless careful attention is being paid, and there would be little to no way to determine what each one does, since font names are typically not very descriptive. Additionally, the fact that some fonts look similar (such as Arial and Helvetica) would require the programmer to have an intricate knowledge of different fonts and how to distinguish them from only one letter.

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Templates used on this page: