Another one that I like to use is the in operator, like so:
Code:
if MyInt in [1,3,5,6] then
...
And another thing to remember is to make use of boolean short circuting.
Where you use boolean algebra, the compiler can stop evaluating the if statement early.
I'm not sure, but I think the second form would be more efficient:
Code:
//1.
If A = true then
If B = true then
if C = true then
DoSomething;
//2.
If (A and B and C) then
DoSomething;
So if A is false, the compiler knows not to even bother checking B and C in the second form.
Bookmarks