returning a value from a function

hey so is there a way to returm a number value from a user defined function just like analogRead() or digitalRead() does?

int button = 4;
if(digitalRead(button)){
 //do whaever
}

in this code when digitalRead() is called it sends back a true or false within the for loop

how could i do this same thing with a user defined function

int number = 0;
  void read_number() {
    if(number >= 10){
       //send back a true
    }
  else {
    //send back a false
  }

if(read_number){
  // have it execute the if statement to what the function sends back
}

ive had a lot of programs that this would help with and i'd be awesome if someone knew how o do this. Maybe is just really easy and i just cant figure it out
thanks

I think you're looking for "return".

(You have all of the source code - why not read it?)

so your saying:

int number = 0;
  void read_number() {
    if(number >= 10){
       return true;
    }
  else {
    return false;
  }

if(read_number){
  // do stuff
}

is that right

No, you've specified a void function.

i think i get it now this is right, right?

int number = 0;

int read_number() {
    if(number >= 10){
       //send back a true
    }
  else {
    //send back a false
  }

if(read_number){
  // have it execute the if statement to what the function sends back
}

Well, read_number is a function pointer, therefore almost certainly non-zero, therefore always true.

As you found out when you tested your code (hint)

ya i tested it and switched up some of the code but it worked
thanks

tommyokie:
ya i tested it and switched up some of the code but it worked
thanks

No, the code you posted never "worked" for any reasonable definition of the word "work" or its participles

if(read_number){