Neopixel gas sensor alarm

hi , i want to make a arduino gas sensor with neopoxel strip to light up the emergency
i have the code for the gas sensor and the neopixel led code but i cannot understand how to connect the two codes toghether so when the sensor senses gas i need my neopixel to light up , and when in stand by to do nothing.
This code is for the gas sensor

// viral science
// gas sensor
int redLed = 12; //led red
int greenLed = 11; //led green
int buzzer = 10; //buzzer
int smokeA0 = A5; //mq2 sensor
int sensorThres = 620; //change the threshold value asper your need

void setup() {
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
}

void loop() {
  int analogSensor = analogRead(smokeA0);

  Serial.print("Pin A0: ");
  Serial.println(analogSensor);

  if (analogSensor > sensorThres) //checks if it has reached threshold value
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

And this code is for neopixel

// Left as-is from the example
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 5

// All of this stuff below is from the example
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);

//NOTE: I tested this code with an 8 LED module, but you should be able to daisy chain multiple modules
//NOTE: Try changing the "8" to "4" to see how it reacts.

// This warning is from the example, probably worth considering
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  // This stuff is from the example, I commented it out since I am not using a Trinket
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  //#if defined (__AVR_ATtiny85__)
  // if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  //#endif
  // End of trinket special code
  strip.begin();
  strip.show();
}

void loop() {

  // This is a 2 color wigwag
  WigWag2(strip.Color(255, 0, 0), strip.Color(255, 0, 0), 200); // Blue and Red
//  ClearLights();
  delay(10);
}



void WigWag2(uint32_t c, uint32_t c2, uint8_t wait) {
  for (int j = 0; j < 20; j++) { // The j<# determines how many cycles
    for (int i = 0; i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, c);
    }
    for (int i = (strip.numPixels() / 2); i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0);
    }
    strip.show();
    delay(wait);

    for (int i = 0; i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0);
    }
    for (int i = (strip.numPixels() / 2); i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, c2);
    }
    strip.show();
    delay(wait);
  }
}

i need to put the neopixel code in if statement , can you help me how please ?

First integrate the gas sensor code and the neopixel code into one program. That will require that you understand both, fairly completely.

Then, use something like the following, with appropriate function calls:

if (gas_sensor_output() > threshold) turn_on_neopixels();

it does not work , it tells me this error

C:\Users\Dragos\Desktop\MQ2_gas\MQ2_gas.ino: In function 'void loop()':

MQ2_gas:54: error: 'else' without a previous 'if'

   else{

   ^

C:\Users\Dragos\Desktop\MQ2_gas\MQ2_gas.ino: At global scope:

MQ2_gas:68: error: expected constructor, destructor, or type conversion before '(' token

   WigWag2(strip.Color(255, 0, 0), strip.Color(255, 0, 0), 200); // Blue and Red

          ^

exit status 1
'else' without a previous 'if'

and the full code is this

// viral science
// gas sensor
int ventilator = 12; //led red
int redLed1=8;
int redLed2=9;
int greenLed = 11; //led green
int buzzer = 10; //buzzer
int smokeA0 = A5; //mq2 sensor
int sensorThres = 120; //change the threshold value asper your need
#include <Servo.h>
Servo myservo;

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 5
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(ventilator, OUTPUT);
  pinMode(redLed1, OUTPUT);
  pinMode(redLed2, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
  strip.begin();
  strip.show();
  {
  myservo.attach(3);  // attaches the servo on pin 9 to the servo object
}
}

void loop() {
  int analogSensor = analogRead(smokeA0);

  Serial.print("Pin A0: ");
  Serial.println(analogSensor);

  if (smokeA0 > sensorThres) strip.show(); //checks if it has reached threshold value
  
   digitalWrite(ventilator, HIGH);
   digitalWrite(redLed1, HIGH);
   digitalWrite(redLed2, LOW);
   digitalWrite(redLed1, LOW);
   digitalWrite(redLed2, HIGH);
   delay(60);
   digitalWrite(greenLed, LOW);
   myservo.write(135);



  else{
  
    digitalWrite(ventilator, HIGH);
    digitalWrite(ventilator, LOW);
    digitalWrite(redLed1, LOW);
    digitalWrite(redLed2, LOW);
    digitalWrite(greenLed, HIGH);
//    noTone(buzzer);
    myservo.write(10);
  }
   delay(100);
   }

  // This is a 2 color wigwag
  WigWag2(strip.Color(255, 0, 0), strip.Color(255, 0, 0), 200); // Blue and Red
//  ClearLights();
void WigWag2(uint32_t c, uint32_t c2, uint8_t wait) {
  for (int j = 0; j < 20; j++) { // The j<# determines how many cycles
    for (int i = 0; i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, c);
    }
    for (int i = (strip.numPixels() / 2); i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0);
    }
    strip.show();
    delay(wait);

    for (int i = 0; i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0);
    }
    for (int i = (strip.numPixels() / 2); i < strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, c2);
    }
    strip.show();
    delay(wait);
  }

  delay(10);
}