You would have to declare 30 to 40 variables with names like gone1, gone2, gone3, ... Or declare an array of gone variables once.
int gone[40]; // an array of 40 gone varaibles. each int to hold the output of an analogRead()
Then in your function, something like:
void someFunction()
{
static byte index = 0;
gone[index] = analogRead(A0);
index ++;
}
The static keyword lets the index variable keep its value from iteration to iteration of the function.