[Tutor] Why does 01 give a syntax error, but 00 (or 00...0) does not?

Alan Gauld alan.gauld at btinternet.com
Sat Mar 5 19:37:59 EST 2016


On 05/03/16 23:33, Ben Finney wrote:

>> But then why is 00...0 valid, that is, does not give a syntax error?
> 
> At one level, the answer is: because the language reference declares
> those rules for the syntax.
> 
> At another level, the answer is: I don't know why that decision was
> made, and on the face of it I disagree.

I assume because decimal numbers are the default and without
this exception you couldn't type 0 without typing 0?0

Where '?' is whatever code is used for decimal. But since its
default you don't normally need a code. I'm not even sure
what it is? Is there one?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list