too few arguments to function

hello freinds

what is wrong in this Syntax

void setup(){}

boolean function(boolean variable)
{
  //Statement ....
  return variable
}
void loop ()
{
   if(function()==1)
    {
       //Statement....
     }
}

i dont know why the compiler refuse this syntax and show me this error description

exit status 1
too few arguments to function

You have told the compiler that function takes one argument, then when you called it, you don't give it one

So now what is the correct to use a function as a condition on if statement!!!

since you have declared function to return a boolean and to have one argument,
this is how you use it

boolean aBoolean = false;
if (function(a) == true)
{
...
}

thanks very very very much for your information :slight_smile: :slight_smile: :slight_smile:
it's work
i should declare two time the variable that i wont to use as a parameter of function like this

bool A = false;

function(bool A)
{
   //code....
   return A;
}

void loop()
{

  if(function(A)==true)
{
    // Statement....

}

}

It is not a good idea to use the same name for a variable that is local to a function as that of another variable with a different scope. It will be confusing to decide which version you are dealing with at some point in the program

Better to give the variable inside the function a different name to avoid the confusion.

Note that in the case of your example the variable A is global and does not actually need to be passed to the function or returned from it anyway