Why does this function not work?
in
Programming Questions
•
2 years ago
Hi all. I know I'm probably doing something really stupid and just can't see it.
It refuses to run with the reason "This method must return a result of type float."
The pType array is definately full. I know it is because I use it elsewhere without problem.
What am I not doing right?
- float pMass(String type) {
if(type == "DIRT") {
return 3.5;
}
if(type == "SAND") {
return 3.5;
}
if(type == "ROCK") {
return 5.0;
}
}
- pMass(pType[foo])
It refuses to run with the reason "This method must return a result of type float."
The pType array is definately full. I know it is because I use it elsewhere without problem.
What am I not doing right?
1