How to get the variable where value of the variable is text+index?

I have variables like text1, text2 etc.
And created a loop where the index increment.
I want to obtain each variable value as the loop progress.
Is there a way that I can set the variable in a format like text+index(text1) and get the value?
for loop statement
if statement x==text+index