Great answers!
Thanks, guys! :)
On 22 August 2010 11:36, Michael Van Canneyt wrote:
>
>
> On Sun, 22 Aug 2010, Dave Coventry wrote:
>
>> I have a function that tests for a series of different conditions
>> according to a value in a 'case...of' block.
>>
>> Result:=false;
>> mylist:=TStringlist.C
On Sun, 22 Aug 2010, Dave Coventry wrote:
I have a function that tests for a series of different conditions
according to a value in a 'case...of' block.
Result:=false;
mylist:=TStringlist.Create;
case i of
1:
begin
if condition1 then
begin
Result:=true;
break;
You should use Else. But if you insist on break, you can insert a
dummy repeat/until loop:
One more thing, since you are creating a TStringList, it is recommended
to enclose your code anyway in a try/finally block irrespective whether
you use the dummy loop or not. This guarantees the freein
On 08/22/2010 10:10 AM, Dave Coventry wrote:
I have a function that tests for a series of different conditions
according to a value in a 'case...of' block.
Result:=false;
mylist:=TStringlist.Create;
case i of
1:
begin
if condition1 then
begin
Result:=true;
You can do several thins:
1. use Else !!
2. Surround (I hope that the proper spelling) everything in try finally and
then in the finally place the free statement.
3. Make a shorter code:
Result := (condition1) OR (condition2) OR (condition3)
Will be the same as your if statment, but shorter.
Ido
I have a function that tests for a series of different conditions
according to a value in a 'case...of' block.
Result:=false;
mylist:=TStringlist.Create;
case i of
1:
begin
if condition1 then
begin
Result:=true;
break;
end;
if condition2 then
be