Reply
Regular Contributor
AlecS
Posts: 34
0

Dynamic variables

Hello,

 

I want to assign values to variables on the fly. For example, I have a variable called, YearXDate. X is a number from 1 to n. I want to assign values to YearXDate while in a loop where loop variable is from 1 to n. How do I do that?

 

Thanks!

Regular Contributor
Cloud Credence
Posts: 76
0

Re: Dynamic variables

Hi,

 

I think you cannot create variable dynamically like that in Apex.

 

You have to use Lists to achieve the same.

 

Please refer to Apex documentation regarding lists.