mercredi 22 février 2017

What is the error in my code that gives me the feedback of 'else' without a previous 'if' in Arduino?

I've been working of a clock program for an arduino school project, and I recently wrote some if/else statements, but I keep getting the error: 'else' without a previous 'if'. Here's a sample of the code with the error:

int x; 
`x = x+1;
     if (x=60);{
      x=0;
     }else{
      x=x;
     }
int y;
y = if (x = 60){
      y = y+1;
    }else{
      y = y;
    }
    if (y = 60){
      y = 0;
    }else{
      y = y;
    }
var z;
z = if (y = 60){
    z=z+1;
    }else(
      z = z;
      )
    if (z = 24){
      z = 0;
    } else {
      z = z;
      )
    }

X represents seconds, y represents minutes, and z represents hours. Honestly, I am extremely new to this type of programming, and I just followed a tutorial. In other words, I'm clueless. Does anyone know what mistake I keep making to get this error? Thanks!

Aucun commentaire:

Enregistrer un commentaire