Answer the question
In order to leave comments, you need to log in
How to switch between variables in Delphi?
For example, I have variables x1,x2,x3...x100. And I need to assign values to all of them. Can this be done using a loop or do I have to manually assign a value?
Answer the question
In order to leave comments, you need to log in
Hello.
Since you can't do it with variables. As the user Vladimir Martyanov said, Vladimir Martyanov will have to create an array. Here's an example of adding a value in a loop.
procedure TForm1.Button1Click(Sender: TObject);
var
num: array [0..100] of Integer;
i: Integer;
begin
for i:=0 to 100 do num[i] := num[i] + 5;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question