What went wrong?

I’m basically new to Arduino and programming.
So i tried to write a small code that should just increas
The value by 1 when i pull pin 2 up, but then wait until i cut
the voltage to the pin before the program can continue.
I’m guessing the code i wrote is total BS. Can anyone show me my mistakes ???

int VAL_CHECK = 0;
int VAL = 25;

void setup()
  pinMode(2, INPUT);		
  Serial.begin(9600);		//Serial

void loop()
 while(digitalRead(2) == HIGH);		
  while(digitalRead(2) == LOW);

 if (VAL_CHECK == VAL){
  digitalWrite(13, HIGH);
  digitalWrite(13, LOW);

I can’t get the program

while(digitalRead(2) == HIGH); causes the code to hang as long as pin 2 is HIGH. Is that what you expected?

I hoped that by puting the code in between the while(digitalRead(2) == HIGH); and while(digitalRead(2) == LOW); i would achieve that i can hold the button pushed down as long as i want without the loop cycling through if i hold the button down longer then i should

I think you need to put the == LOW first, then the == HIGH.

 while(digitalRead(2) == HIGH);

You have to use braces like you do with the if statement to put a block of code in a while loop.

 while(digitalRead(2) == HIGH)
    // your code here

The semicolon you used means that will either do nothing if the pin is LOW or it will stay there as long as the pin is HIGH.

Also declare a variable for your pin number. If you need to rearrange things it will be much easier.