Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Martin Wynne via fpc-pascal
Hi Thomas, The error is not the file content after "end.". The error is not having the expected "end;" after "begin". This works ok: _ program test; begin end; end. abc 123 _ Martin. ___ fpc-pasca

Re: [fpc-pascal] case statement

2023-12-14 Thread Martin Wynne via fpc-pascal
I've been using ELSE in IF statements and in CASE statements for 25 years without realising there was a problem. What a dim-wit I have been. Martin. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailma

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Martin Wynne via fpc-pascal
On 17/06/2023 19:07, Travis Siegel via fpc-pascal wrote: This is interesting, because it's the first time I've ever seen "break" as a valid command in pascal, and I've been using pascal since the mid/late 80s.  All kinds of dialects too, and I've never seen break as a keyword.  C, Python, Perl,

Re: [fpc-pascal] Pause Key

2023-04-13 Thread Martin Wynne via fpc-pascal
On 14/04/2023 01:31, James Richters via fpc-pascal wrote: Does anyone know what's up with the Pause key in Windows? Is there some way to tell if it was pushed? Hi James, // Tform.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState); begin if Key=VK_PAUSE

Re: [fpc-pascal] Get highest element of a StringList

2022-09-12 Thread Martin Wynne via fpc-pascal
On 12/09/2022 15:37, James Richters via fpc-pascal wrote: So I could just do this? Index:= MyStringlist.IndexOfName(SearchName); If Index >=0 then MyValue := MyStringlist[Index].ValueFromIndex; Hi James, I would probably do try with MyStringList do MyValue:=ValueFromIndex[IndexOfN

Re: [fpc-pascal] Get highest element of a StringList

2022-09-12 Thread Martin Wynne via fpc-pascal
On 12/09/2022 14:16, James Richters via fpc-pascal wrote: The problem with the for in loop is that I need the index. Hi James, You don't need a loop for that: index:=MyStringlist.IndexOfName; see: https://www.freepascal.org/docs-html/rtl/classes/tstrings.indexofname.html martin.

Re: [fpc-pascal] Get highest element of a StringList

2022-09-10 Thread Martin Wynne via fpc-pascal
On 10/09/2022 17:01, James Richters via fpc-pascal wrote: For Loop := 0 to MyStringList.Count-1 do It would be nice to not have the -1 I don't understand what is wrong with Count-1, but you can get the highest index like this if you wish: high_index:=Length(Trim(MyStringList.Text))-Length(

Re: [fpc-pascal] How to find where my app consumes CPU?

2021-05-19 Thread Martin Wynne via fpc-pascal
On 18/05/2021 20:59, Bo Berglund via fpc-pascal wrote: I have a pretty sizable console app written with Delphi 15 years ago but ported to Linux using FreePascal (3.2.0) with Lazarus (2.0.12) as IDE. I have the same problem with high CPU usage for a 20-year-old Delphi App compiled in Lazarus(2.