What is the difference between # and the 0 ?
By toyoil
@toyoil (31)
2 responses
@owlwings (43910)
• Cambridge, England
12 Aug 10
The 'hash' or 'pound' sign (#) is used in different ways in different contexts.
On the US typewriter/computer keyboard, the sign is found in the top row when SHIFT+3 is pressed. On the British keyboard, that combination produces the '£' (pound) sign.
It is very commonly used to represent the word 'number' as in 'My phone # is ...' or 'Our office is on floor #3'.
In many programming languages, the '#' sign may be used as a 'placeholder' or a 'formatting' sign meaning 'any numeral, 0 through 9'. It is often necessary to tell a program what format to use when printing a number. If the number to be printed were, say: 3.14159 but you wanted it to display as 3.14, you would use the formatting string "#.##" to tell the program that you want ANY number held in the variable to be displayed to two decimal places. The character '0' can also be part of a formatting string: "0#.##" would cause the program to print '03.14' and "#.##0" would cause it to print '3.140'. This is often used where columns of figures are required to align vertically.
1 person likes this