Re: [Lazarus] Break in 'case...of' block.

2010-08-22 Thread Dave Coventry
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

Re: [Lazarus] Break in 'case...of' block.

2010-08-22 Thread Michael Van Canneyt
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;

Re: [Lazarus] Break in 'case...of' block.

2010-08-22 Thread patspiper
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

Re: [Lazarus] Break in 'case...of' block.

2010-08-22 Thread patspiper
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;

Re: [Lazarus] Break in 'case...of' block.

2010-08-22 Thread ik
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

[Lazarus] Break in 'case...of' block.

2010-08-22 Thread Dave Coventry
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