What is the best way to write a no-op statement in Delphi?
Take this code:
if a=b then
SomeOldStatement
else
AnotherStatement;
And say that you temporarily want to rem out SomeOldStatement
.
Would you just go for this solution:
if a=b then
//SomeOldStatement
else
AnotherStatement;
Personally I don't like the empty then
section and would like to have something compilable in there...
if a=b then
NoOp
//SomeOldStatement
else
AnotherStatement;
Not sure why you need anything there at all (e.g. I'm happy with "then else").
But if you want something compilable there, I would do this:
if a=b then
begin end
//SomeOldStatement
else
AnotherStatement;
An empty begin block is the best noop I know of in Delphi. It will produce no assembler code and thus no overhead.