Switch Statement case '0': .. case '9'

Paul phshaffer at gmail.com
Thu Jun 14 08:59:40 PDT 2012


The book in section 3.5 gives these valid case examples:

case ’0’: .. case ’9’:
case ’A’: .. case ’Z’: case ’a’: .. case ’z’:
case ’.’, ’,’, ’:’, ’;’, ’!’, ’?’:

In my code:

case "STEP01": ...compiles and works correct
case "STEP01", "STEP02": ...compiles and works correct
case "STEP01": .. case "STEP50": ...compiler reports:

iccstats.d(27): Error: Integer constant expression expected 
instead of "STEP01"
iccstats.d(27): Error: Integer constant expression expected 
instead of "STEP50"
iccstats.d(27): Error: integral constant must be scalar type, not 
const(char[])

Help please.


More information about the Digitalmars-d-learn mailing list