Voids in loop using "if" Function

Should/Could this work?

void setup() {

 ExampleVoid();//I know that this should work, But will only call it once
 

void loop() {

 if (Var1==Var2){
  ExampleVoid();  
 }

}

void ExampleVoid()
{
  DoCoolStuff;
}

Want to reduce loop time by only using code when needed.

It could work if you were to auto format your code to see that there is a missing thingy.

"void" means "nothing", "empty", it's a keyword used to indicate that a function doesn't return any values. The word you're looking for is "function", ExampleVoid is a function without any parameters and a "void" return type.

You're missing a '}' at the end of the "setup" function, but other that that, it should work, why don't you try it?

Pieter

Because I dumb dumb. Got a "Not declared" error for the specific function I wanted to call and could not seem to track down the error. eventually found I had not closed off the previous function.