Possible Duplicate:
Why use monospace fonts in your IDE?
Virtually all coders (and code editors) use fixed width fonts. Why is this?
Possible Duplicate:
Why use monospace fonts in your IDE?
Virtually all coders (and code editors) use fixed width fonts. Why is this?
Probably because it makes the code easier to scan - you have "blocks" of code, ie. text that lines up vertically far more often than you would in normal prose. If the font is not fixed width than it wouldn't be visually aligned.
Because it helps with code layout and make it easier to spot errors as lines are a consistent length for a given number of characters.
It is also historical as we used to use terminals with fixed width fonts.
open some code in your favourite editor... I'm presuming by default that your text editor will have a fixed-width font set.
Now change the font to Comic-Sans..... enough said!
Seriously though, fixed-width is much much clearer to read.
Mostly for outlining. However it's also a habit. I come from the old school IDE's while they were still in MS-DOS.
Also companies like Microsoft have made fonts to make it "easier" to code with. I prefer the Consolas font myself while coding in Visual Studio.
Grz, Kris.
It's a matter of choice. I personally prefer to use the very elegant Comic Sans or Purisa font for programming.
It greatly enhances readability - expecially of punctuation characters which have a very important role in code and which variable width fonts often "squeeze" into minimal space.
I would add a few minor reasons, mainly related to the code's visual flow:
One typical example would be aligning table declarations so that it will look like a table in the code.
var sn = [ 8349824, 3094230, 1]; // first table line
var longname1 = [ 421, 1324, 5382920]; // second table line
// Try and do something as readable in variable width font!
You can agree on a line-width limit that will have a consistent effect.
<code>
block on the web, in your basic text editor on a remote terminal or in your graphical IDE with antialiased fonts - you will immediately recognize the code.In short, fixed-width font allows for finer grained control over source code appearance and readability, independant from the availability of any given font.
I know I am a week late to the game but I can't believe that there is no mention of programming languages like FORTRAN that basically required fixed width fonts. Comment chars had to go in column 1, line continuation chars in column 6 and that is not even mentioning the inherent fixed width font effect of punch cards. Mention has been made of fixed width fonts on terminals, but programming predates even that.