Enter different values of a variable into program

Is there someway of doing this in an Arduino program? Enter different values of a variable at the start of the program and then let the rest of the program process the variable with each value.
For example let x have the values 3,9,10,-2,-7,-6. Then you have x=3, x=9, etc processed by the rest of the program. The program will loop around to pick up consecutive values of the variable.
This could be very useful.

Of course there is

See Serial input basics - updated

Not very clear to me. There ain't "different values of a variable", what you described here is an array of values, then the code will just cycle it to pick the values up in sequence. Just to make things clearer, this is a small and basic example:

int list[6] = {3,9,10,-2,-7,-6};
int pList = 0;
int x;

void loop() {
  if (pList <= 5) {
    x = list[pList++];
    // do here what you need to do with "x"
...
    // To test it, start printing the value to serial:
    Serial.print("x=");Serial.println(x);
    // Just a delay to simulate operations...
    delay(500);
...
  }
  // Just another delay to simulate optional additional tasks...
  delay(500);
}

If this isn't what you're asking for, please describe your requirements, together with a code you're trying to add that behaviour to.

You will need some kind of input device for inputting the values.

A keyboard, Buttons, an enocder, a bluetooth to serial module

or if the "input" shall be inside the code defining a function that has a parameter.

void myFunction(int  myParameter) {
  Serial.print("x-square=");
  Serial.println(myParameter * myParameter);  
}

void setup() {
  Serial.begin(115200);
  Serial.println("Setup-Start");
}


void loop() {
  myFunction(3);
  myFunction(9);
  myFunction(10);
  myFunction(-2);
  myFunction(-7);  
}

@petercl14
You are working on an informatic project and what is needed most in an informatic project is detailed information.

The more precise you ask the more precise the answers will be

no hope
Read OP's other topics ...