How to reference a variable composed input name for subscription?

Hi,

I have a dynamic page that does:

section() {
def i=0
for(i = 0; i < areas; i++){
paragraph "Configuration of area "+i
input “presenceSwitch”+i, “capability.switch”, title: “Pick your area “+i+” presence switch”, required: true
}
}

Then I would like to subscribe my inputs at initialization with something like:

def initialize() {
def i = 0;
for (i=0;i<areas;i++) {
subscribe(${“presenceSwitch”+i}, “switch”, dummy)
}
}

But it doesn’t work; therefore, my question is what is the right way that I can use the string reference of an input name for a device subscription? Looks to me like this should have been already answered but I wasn’t able to find the solution.

Thanks!