How to adress virtual pin

I have to “initialize” many virtual pins in the same way. Using a for loop would be the easiest but is it possible to replace the “V0”, “V1” with a variable? I tried the following with no success…

//This works
BLYNK_WRITE(V1){Mach[0].State = param.asInt();
if(Mach[0].State == 0){Blynk.virtualWrite(V1,0);Blynk.setProperty(V1,"color","#000000");}// not exist = black
if(Mach[0].State == 1){Blynk.virtualWrite(V1,1);Blynk.setProperty(V1,"color","#D3435C");}//red= out of order
}
BLYNK_WRITE(V2){Mach[1].State = param.asInt();
if(Mach[1].State == 0){Blynk.virtualWrite(V2,0);Blynk.setProperty(V2,"color","#000000");}// not exist = black
if(Mach[1].State == 1){Blynk.virtualWrite(V2,1);Blynk.setProperty(V2,"color","#D3435C");}//red= out of order
}

//This does not work
//int i;
//for(i=1;i<3;i++){
//String Vpin="V"+String(i);
//BLYNK_WRITE(Vpin){Mach[i-1].State = param.asInt();
//if(Mach[i-1].State == 0){Blynk.virtualWrite(Vpin,0);Blynk.setProperty(Vpin,"color","#000000");}// not exist = black
//if(Mach[i-1].State == 1){Blynk.virtualWrite(Vpin,1);Blynk.setProperty(Vpin,"color","#D3435C");}//red= out of order
}

Hello. Already there - https://github.com/blynkkk/blynk-library/blob/master/examples/More/PrintAllVirtual/PrintAllVirtual.ino

Default function. OK many thanks.

I bought some energy minutes ago (13000 automatic.industries@gmail.com) but they are not showing up yet. Normal?

And by the way, Blynk rocks! :wink:

Usually - no. Does logout-login helps?

Don’t see this account. Is that local server?

My email address for Google Play is not the same as the Blynk account. I created a new Blynk account with the same address: automatic.industries@gmail.com. Hope this can settle the issue.

I run the example and get the following error for this line:
for (auto i = param.begin(); i < param.end(); ++i) {
“i does not name a type”

please try :

int i

Following error message:

PrintAllVirtual.ino: In function ‘void BlynkWidgetWriteDefault(BlynkReq&, const BlynkParam&)’:
PrintAllVirtual:43: error: request for member ‘asString’ in ‘i’, which is of non-class type ‘int’
request for member ‘asString’ in ‘i’, which is of non-class type ‘int’