trying to make the led shade just when you press the buttom... does not work

Hello people, i have been programing arduino for about 2 weeks and my first try to make my own program was to make the led shade from low to high to low. It doesnt work i dont know why, sorry im new at programing and electronics but I’ll just copy below the code that i have. Im just hoping you guys can help me to fix it. thanks!!

const int LED=13;
const int BUTTON=7;

int val=0;
int i=0;

void setup(){
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT);
}

void loop(){
  
  val=digitalRead(BUTTON);
  
  if(val=HIGH) {
     
    for (i=0;i<255;i++){
      digitalWrite(LED, i);
      delay(10);
    }
    
    for (i=255;i>0;i--){
      digitalWrite(LED, i); 
      delay(10);
    }
  }
    
  else {
    digitalWrite(LED, LOW);
  }
 
}

Please go back and edit your post and put the code inside [ code] [ /code] tags.

Then change this line:

if(val=HIGH) {

to

if(val==HIGH) {

Please use code tags.

Read this before posting a programming question

  for (i=255;i>0;i--){
      digitalWrite(LED, i);
      delay(10);
    }

Do you mean analogWrite? digitalWrite is either on or off.

Which Arduino is it? On some Arduinos pin 13 is not a PWM pin.