while(...){ ... }else ...

MattCoder via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 18 08:03:23 PST 2015


On Sunday, 18 January 2015 at 15:52:24 UTC, Jens Bauer wrote:
> ... Ah, much more readable.

Maybe I misunderstood your question, but what you think about 
this way:

while(1){
     if(c >= '0' && c <= '9')
     {
         /* number */
         c = *s++;
         ... do something with c ...
     }
     else if ((c >= 'A' && c <= 'Z') || (c >='a' && c <= 'z') || c 
== '_')
     {
         /* token */
         c = *s++;
     }
     else if(debug)
     {
         /* error */
         break;
     }
}

Matheus.


More information about the Digitalmars-d mailing list