an error occured whileupluading sketch

Arduino: 1.8.10 (Windows 7), Board: "Arduino Nano, ATmega328P"

Sketch uses 916 bytes (2%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

i dont understand what actually the problem. i dont find any issue with the codes,it complied succesfully but cant upload to the uno

im uploading my code below

int control=7; // PIN FOR SWITCH CONTROL

int out1=8; // PIN FOR RED LIGHT
int out2=9; // PIN FOR GREEN LED

void setup(){
pinMode(control,INPUT); // INITIALISE INPUT PIN
pinMode(out1,OUTPUT); // INITIALISE OUTPUT PIN
pinMode(out2,OUTPUT); // INITIALISE OUTPUT PIN

}

void loop()
{
digitalWrite(out1,HIGH); // RED LED IN HIGH MODE BY DEFAULT
int val=digitalRead(control); // READ THE VALUE FROM THE SWITCH CONTROL PIN

if (val=HIGH) // TO GLOW GREEN LED WHEN THE CONTROL OF SWITCH IS HIGH
{
digitalWrite(out1,LOW);
digitalWrite(out2,HIGH);
}

}

if (val=HIGH)That’s going to cause you trouble when you do get it to upload.

i got a new error

Arduino: 1.8.10 (Windows 7), Board: "Arduino Nano, ATmega328P"

Sketch uses 920 bytes (2%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

need help

(deleted)