void value not ignored as it ought o be??? program to act like map ....beginer

I am trying to write a code to perform just like map but to not truncate the data and save it as a float. I keep getting the error of void value not ignored and I dont understand why. Thank you for your help, here is my code

float x=0;
void setup ()
{
Serial.begin(9600);
Serial.println(x);
x=mapf(720,0,1023,0,5);
}

void mapf(float number,float lower,float upper,float newlower,float newupper)
{
float range=upper-lower;
float perc=number/range;
float Nrange=newupper-newlower;
float Nval=newlower+Nrange*perc;
return Nval;
}

void loop ()
{

}

When you write "void mapf(......" you are telling the compiler that this function won't be returning a value. later on in the function you have "return Nval;" which will confuse the compiler.

If you want a function to return a float you need to define it "float mapf(....."

...R

Thank you that fixed it! Ton of help