Dynamic variable names: Difference between revisions
Content deleted Content added
Line 903:
<lang Pascal>
PROGRAM ExDynVar;
{$mode objfpc}{$H+}{$J-}{R+}
(*
* Free Pascal Compiler version 3.2.0 [2020/06/14] for x86_64
Line 912 ⟶ 914:
* dynamic variables at runtime.
*)
USES
Generics.Collections,
SysUtils,
Line 918 ⟶ 922:
TYPE
Tdict = specialize TDictionary <
VAR
VarName:
strValue:
VarValue:
D:
FUNCTION SetType ( strVal:
(* If the value is numeric, store it as numeric, otherwise store it as
BEGIN
TRY
SetType := StrToFloat ( strVal ) ;
EXCEPT
SetType := strVal ;
END;
END;
Line 943 ⟶ 948:
Write ( 'Enter variable Value : ' ) ;
ReadLn ( strValue ) ;
VarValue := SetType ( strValue ) ;
TRY
BEGIN
|