Semicolon can be left out after do-while
Timon Gehr
timon.gehr at gmx.ch
Tue Apr 12 11:57:26 PDT 2011
I just noticed a little oddity.
Why does this code compile? The equivalent C code is rejected:
import std.stdio;
//#include <stdio.h>
int main(){
int a,b;
do{
scanf("%d %d",&a,&b);
}while(a<b) //note missing semicolon here
return 0;
}
The grammar specifies this correctly, but then again, the example uses the
semicolon. (http://www.digitalmars.com/d/2.0/statement.html#DoStatement)
More information about the Digitalmars-d-learn
mailing list