# Why is this happening?

Here is my code, info below

``````/*
* LED Matrix
* O = LED
* Line = Pin
* Vertical = Cathode
* Horizontal = Anode
* -OOOOO
* -OOOOO
* -OOOOO
* -OOOOO
* -OOOOO
*  IIIII
*  Matrix controlling pins: 53 - 43
*  Y = 53 - 49
*  X = 47 - 43
*  Pin 48 is an input to control power
*/
const int y1 = 53;
const int y2 = 52;
const int y3 = 51;
const int y4 = 50;
const int y5 = 49;
const int x1 = 47;
const int x2 = 46;
const int x3 = 45;
const int x4 = 44;
const int x5 = 43;
int Power = 0;
int GridPower = 0;
void setup() {
// put your setup code here, to run once:
pinMode(48, INPUT);
pinMode(y1, OUTPUT);
pinMode(y2, OUTPUT);
pinMode(y3, OUTPUT);
pinMode(y4, OUTPUT);
pinMode(y5, OUTPUT);
pinMode(x1, OUTPUT);
pinMode(x2, OUTPUT);
pinMode(x3, OUTPUT);
pinMode(x4, OUTPUT);
pinMode(x5, OUTPUT);
}

void CheckPwr() {
//This makes sure that the Power variable stays from 0 - 1\\
if (Power > 1) {
Power = 1;
}
else if (Power < 0) {
Power = 0;
}
}
void CheckGridPwr() {
//This makes sure that the GridPower variable stays from 0 - 1\\
if (GridPower > 1) {
GridPower = 1;
}
else if (Gridpower < 0) {
GridPower = 0;
}
}
void loop() {
// put your main code here, to run repeatedly:
CheckPwr();
CheckGridPwr();
if (Power = 0) {
GridPower = 0;
}
else if (Power = 1) {
GridPower = 1;
}
}
``````

So, the error its giving me is on the line, else if (Power < 0) {
and the error is
exit status 1
expected unqualified-id before ‘else’

`````` if (Power = 0) {
GridPower = 0;
}
else if (Power = 1) {
GridPower = 1;
}
``````

For one thing, you want == in these statements, NOT =.

For another, quit getting cute with the slashes in the comments. The backslash has special meaning.

``````  if (GridPower > 1) {
GridPower = 1;
}
else if (Gridpower < 0) {
GridPower = 0;
}
``````

Finally, case matters. GridPower is not the same variable as Gridpower.