float array_of_values = new float[10];
void setup(){
// ...
}
void draw(){
// ...
// You can use the values here.
if( array_of_values[0] < 50 ){
// ...etc
}
}
class YourClass {
void yourClassFunction(){
for( int i = 0; ... ){
// Calculate distance here
array_of_values[i] = the_ith_distance;
}
// No need to return anything.
}
}