Need help implementing logic

Good afternoon, dear Arduins!

Please help me write a working sketch. The logic is very simple. When the switch is turned on, the servo should turn smoothly 180 degrees, and at the same time the LED should turn on smoothly to maximum brightness. Or, when the switch is turned off, the servo drive should slowly turn to the initial position of zero degrees, and the LED should simultaneously slowly go out.
Here’s a rough sketch, but the sketch doesn’t work.

#include <Servo.h> // Connect the library servo.
int ServoPin = 11; // Declare a global variable for the servo pin.
int LedPin = 10;   // Declare a global variable for the LED pin
int SwitchPin = 9;  // Declare a global variable for the switch pin.
int GradusServo ;  // Declaring a global variable for the degree of the drive, initially = 0.
int i = 0;

void setup (){
pinMode (LedPin, OUTPUT);  // Assign LED pin to output.
pinMode (SwitchPin, INPUT); // Assign the pin of the switch to the input.
GradusServo = 0;
i = 0;

void loop () 
  if (digitalRead (SwitchPin)== HIGH)
   int i=0; i<=255; i++; 
   GradusServo = 0; 
   digitalWrite (LedPin, i);
   delay(5);    // set a delay for the effect