[fpc-pascal] specify variable name with string variable

Dmitry Boyarintsev skalogryz.lists at gmail.com
Sun Jul 7 23:09:01 CEST 2019


associative array?

On Sunday, July 7, 2019, James Richters <james at productionautomation.net>
wrote:

> This might sound silly,  but is it possible to somehow specify a variable
> with a string containing the name of the variable?
>
> For example:
>
> Var
>    MyVariable1 : Word;
>    MyVariableName : String;
>
> Procedure ShowVariable(Variablename);
> Begin
> Writeln(Variablename,' = $', inttohex(    (Somehow get the value of the
> variable specified by the name here ) ,4));
> End;
>
> Begin
> MyVariableName:= 'MyVariable1';
> ShowVariable(MyVariableName);
> End.
>
> Is such a thing possible?
>
> James
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190707/887bc313/attachment-0001.html>


More information about the fpc-pascal mailing list