That is true for all C block constructs. If there is only one statement within the block then curly braces are optional. So including curly braces in all instances, is okay, and may be preferable for translators.
I've adopted the more generic begin..end construct, rather than integrating braces with if .. endif etc. I think the code is quite easy to follow for BASIC programmers, certainly easier to write. With the string library and class generics, I've got nearly 700 lines of sample code so far.
Here is a sample: (these functions also support wide characters)
method StringObject StringRtrim(StringObject this)
begin
int i;
int w=this->width;
int n=this->count;
char*c = w * n - w + CharBase(this,0);
if (w<2)
begin
for (i==n-w; to i<=0; step decr i)
begin
if (*c>32) then break;
decr c;
end
return StringGetMid(this, 1, i, -1);
end
else
begin
for (i==n-w; to i<=0; i-=w)
begin
if ((c[0]>32)or(c[1] != 0)) then break;
c+=w;
end
return StringGetMid(this, 1, i>>1, -1);
end
end
method int StringInstr(int i, StringObject this, StringObject k)
//MATCHING MIXED WIDTHS BUT ONLY ON THE LOWER BYTE
begin
char*tb = CharBase(this,0);
char*tc=tb;
char*kc=CharBase(k,0);
char*te=tc+this->count*this->width;
char*ke=tc+k->count*k->width;
if (i<0) then i+=this->count+1; // offset from right
decr i; //indexbase 0
tc+=i*this->width; // offset
if (tc>=te) then return 0;
if (kc>=ke) then return 0;
char*td;
char*kd;
int tw=this->width;
int kw=k->width;
while (tc<te)
begin
if (*tc==*kc)
begin
td=tc;
kd=kc;
while (*td==*kd)
begin
td+=tw;
kd+=kw;
if (kc==ke) then return ((td-tb)>>(tw-1))+1;
if (td==te) then return 0;
if (*td==*tc) then tc=td-1; // possible next match
end
end
tc+=tw;
end
end
function StringMethods StringClassTableBuild()
begin
static StringClassTable t;
StringMethods vm references t;
vm->Redim references method StringRedim;
vm->Get references method StringGet;
vm->Set references method StringSet;
vm->GetChars references method StringGetChars;
vm->SetChars references method StringSetChars;
vm->Show references method StringShow;
vm->GetMid references method StringGetMid;
vm->SetMid references method StringSetMid;
vm->Join references method StringJoin;
vm->Asc references method StringAsc;
vm->Ucase references method StringUcase;
vm->Lcase references method StringLcase;
vm->Ltrim references method StringLtrim;
vm->Rtrim references method StringRtrim;
vm->Instr references method StringInstr;
return vm;
end