if (int x=..) but no while(int x=..) ?

Lionello Lunesu lio at remove.lunesu.com
Tue Mar 14 00:39:54 PST 2006


I like the fact that we can do

# if (int recvd = ts.receive(buffer)) {...}

but is there any reason why this shouldn't apply to "while" also?

# while (int recvd = ts.receive(buffer)) {...}

main.d(26): found 'recvd' when expecting '.' following 'int'
main.d(26): found '=' when expecting identifier following 'int.'
main.d(26): found 'ts' when expecting ')'
main.d(26): found ')' when expecting ';' following 'statement' 





More information about the Digitalmars-d mailing list