kinda library?

i have some 74HC574 ics that i am using to multiplex, i want a library like function (so a custom function i think) to write the data and pulse the clock pins, this is what i have:

void data(s,t,u,v,w,x,y,z){
  
  if(s == 0){
    digitalWrite(datas, LOW);
  }
  if(s == 1){
    digitalWrite(datas, HIGH);
  }
  if(t == 0){
    digitalWrite(datat, LOW);
  }
  if(t == 1){
    digitalWrite(datat, HIGH);
  }
  if(u == 0){
    digitalWrite(datau, LOW);
  }
  if(u == 1){
    digitalWrite(datau, HIGH);
  }
  if(v == 0){
    digitalWrite(datav, LOW);
  }
  if(v == 1){
    digitalWrite(datav, HIGH);
  }
  if(w == 0){
    digitalWrite(dataw, LOW);
  }
  if(w == 1){
    digitalWrite(dataw, HIGH);
  }
  if(x == 0){
    digitalWrite(datax, LOW);
  }
  if(x == 1){
    digitalWrite(datax, HIGH);
  }
  if(y == 0){
    digitalWrite(datay, LOW);
  }
  if(y == 1){
    digitalWrite(datay, HIGH);
  }
  if(z == 0){
    digitalWrite(dataz, LOW);
  }
  if(z == 1){
    digitalWrite(dataz, HIGH);
  }
  else{
    digitalWrite(datas, LOW);
    digitalWrite(datat, LOW);
    digitalWrite(datau, LOW);
    digitalWrite(datav, LOW);
    digitalWrite(dataw, LOW);
    digitalWrite(datax, LOW);
    digitalWrite(datay, LOW);
    digitalWrite(dataz, LOW);
  }
}
void clock(xclk){
  
 if(x == 0){
 digitalWrite(clk0, HIGH);
 delay(10);
 digitalWrite(clk0, LOW);
 }
 if(x == 1){
 digitalWrite(clk1, HIGH);
 delay(10);
 digitalWrite(clk1, LOW);
 }
 if(x == 2){
 digitalWrite(clk2, HIGH);
 delay(10);
 digitalWrite(clk2, LOW);
 }
 if(x == 3){
 digitalWrite(clk3, HIGH);
 delay(10);
 digitalWrite(clk3, LOW);
 }
 if(x == 4){
 digitalWrite(clk4, HIGH);
 delay(10);
 digitalWrite(clk4, LOW);
 }
 if(x == 5){
 digitalWrite(clk5, HIGH);
 delay(10);
 digitalWrite(clk5, LOW);
 }
 if(x == 6){
 digitalWrite(clk6, HIGH);
 delay(10);
 digitalWrite(clk6, LOW);
 }
 if(x == 7){
 digitalWrite(clk7, HIGH);
 delay(10);
 digitalWrite(clk7, LOW);
 }
 else{
   digitalWrite(clk0, LOW);
   digitalWrite(clk1, LOW);
   digitalWrite(clk2, LOW);
   digitalWrite(clk3, LOW);
   digitalWrite(clk4, LOW);
   digitalWrite(clk5, LOW);
   digitalWrite(clk6, LOW);
   digitalWrite(clk7, LOW);
 }
}

not working, any thoughts? am i allowed to do the data(s,t,u,v,w,x,y,z) thing, or does it have to be data()?

Look at where your else block is attached. All but the first if statement should be else if statements.

You can simplify that code a lot, though.

  if(s == 0){
    digitalWrite(datas, LOW);
  }
  if(s == 1){
    digitalWrite(datas, HIGH);
  }

could be

digitalWrite(datas, s);

If you want to call digitalWrite only when s is 0 or 1:

if(s >= 0 && s <= 1)
  digitalWrite(datas, s);

Ok, i tried this:

void data(s,t,u,v,w,x,y,z){
  
 digitalWrite(datas, s);
 digitalWrite(datat, t);
 digitalWrite(datau, u);
 digitalWrite(datav, v);
 digitalWrite(dataw, w);
 digitalWrite(datax, x);
 digitalWrite(datay, y);
 digitalWrite(dataz, z);
}

but i still get the same error message

variable or field 'data' declared void

it also says all the stuvwxyz variables are not declared, even though they are...same for the clock() function

void data(s,t,u,v,w,x,y,z){

What type are s,t,u,v,w,x,y,z?

What type are s,t,u,v,w,x,y,z?

And how are you calling data()?

i figured they could be boolean??? not sure though

boolean s = 0;
boolean t = 0;
boolean u = 0;
boolean v = 0;
boolean w = 0;
boolean x = 0;
boolean y = 0;
boolean z = 0;

do i make them global or local variables?

umm, im not quite sure how i am calling it (sorry) i was just trying to make a custom function for writing the data pins...

All arguments to functions need to be types.

void data(boolean s, boolean t, ...

AWESOME, i dont know what i would do without you guys, thanks a ton. (it worked by the way :))