Make your own free website on

octal number in programing language


switch (mon) {
    case 01 :
        txt = "Jan";
    case 02 :
        txt = "Feb";
    case 03 :
        txt = "Mar";
    case 04 :
        txt = "Apr";
    case 05 :
        txt = "May";
    case 06 :
        txt = "Jun";
    case 07 :
        txt = "Jul";
    case 08 :
        txt = "Aug";
    case 09 :
        txt = "Sep";

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 16: 'case' statements must be terminated with a ':'
case 08 :

What does that error message appear ? @

It is common to see examples of script using decimal numbers and hexadecimal numbers. We know 12 means decimal and 0x12 means hexadecimal.

Octal numbers are less popular. By definition, a number starts with 0 is treated as octal number in programing language. This somewhat conflicts with the real world.

In real world, for the appearance of neat justificaton, we might write our series of numbers as 01,02,03,04,05,06,07,08,09,10,12,,,,. For a 3 digit number we might like to use 001,002,003,.....099,100; But, a number starts with 0 is treated as octal number.

x=08; will be illegal in script.

Error message will appear. Usually the error message will not tell us what is really the cause of this error. It will not tell "octal number can not accept a digit greater than 7"; Commonly, the error message says "missing ;" or "missing :";

x=011 will be treated as x=9 without warning or error message;

x=Number("011"); does the same thing.