[fpc-pascal] Selecting Records with a variable

James Richters james.richters at productionautomation.net
Sun Dec 20 04:02:45 CET 2020


No, this is just a simplified example.. 
The procedure will be working with dozens of records, so I need a way to call the procedure and specify which element of all the records to use...
it will not be called for every element.

James 

-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of wkitty42--- via fpc-pascal
Sent: Saturday, December 19, 2020 8:26 PM
To: fpc-pascal at lists.freepascal.org
Cc: wkitty42 at windstream.net
Subject: Re: [fpc-pascal] Selecting Records with a variable

On 12/19/20 7:16 PM, James Richters via fpc-pascal wrote:
> Is there some syntax that would work to select the correct record based on the variable so I can avoid having all the If statements?

do you need to show only one at a time or are you looping through and printing all of them each time?

if you need them all every time and if you are looping through them, don't... 
just call ShowAxis and writeln all of them one after the other...

Procedure ShowAxis;
begin
   writeln(AxisValue.X);
   writeln(AxisValue.Y);
   writeln(AxisValue.Z);
   writeln(AxisValue.A);
   writeln(AxisValue.B);
   writeln(AxisValue.C);
end;


--
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list where it belongs!* _______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list