Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

octal values in int  RSS feed

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int i1 = 07; ==> no error
int i2 = 08; ==> compiler error
int i3 = 09; ==> compiler error
int i4 = 010; ==> no error

Plese explain the above nature of output.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The valid octal numerals are 0,1,2,3,4,5,6 and 7.
So, you get an error when you try to assign something which is not a valid octal numeral.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!